question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cockroachdb crdb - enums not working with prepared statements

See original GitHub issue
  • asyncpg version: 0.21.0
  • CockroachDB version: v20.2.1
  • PostgreSQL version: 12.4
  • Do you use a PostgreSQL SaaS? If so, which? Can you reproduce the issue with a local PostgreSQL install?:
  • Python version: 3.9.0
  • Platform: linux-x86_64
  • Do you use pgbouncer?: no
  • Did you install asyncpg with pip?: yes
  • If you built asyncpg locally, which version of Cython did you use?:
  • Can the issue be reproduced under both asyncio and uvloop?: didn’t test uvloop

enums have just been added to crdb. testing asyncpg shows an issue with prepared statements.

running this:

await conn.execute("INSERT INTO accounts2 (id, balance, mode) VALUES ($1, $2, $3)", 9, 2000, "active", ) throws

    statement = await self._protocol.prepare(stmt_name, query, timeout)
  File "asyncpg/protocol/protocol.pyx", line 163, in prepare
asyncpg.exceptions.FeatureNotSupportedError: CTEs may not be correlated

the prepared statement works fine in pgsql. enums work fine without prepared statements.

I have a silly bug exerciser, but needs some cleanup, you can see the relevant test2 functions if you need working code. i’ve tested psycopg2 and asyncpg against crdb and pgsql and out of the four runs, only asyncpg+crdb shows an issue.

crdbissues.py.txt

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:2
  • Comments:8

github_iconTop GitHub Comments

1reaction
rafisscommented, Aug 7, 2021

Version 21.2 of CockroachDB will support correlated CTEs (https://github.com/cockroachdb/cockroach/pull/63956) – hopefully that will help.

0reactions
rafisscommented, Sep 1, 2021

Just to clarify, what is the error you get with the

  SELECT DISTINCT ON (ACCOUNT.ID) * 
  FROM ACCOUNT
  WHERE ID = ANY($1 :: uuid[])
  ORDER BY ACCOUNT.ID, ACCOUNT.TIMESTAMP DESC

query?

Read more comments on GitHub >

github_iconTop Results From Across the Web

cockroachdb crdb - enums not working with prepared statements
cockroachdb crdb - enums not working with prepared statements. MagicStack. 24 November 2020 Posted by toppk. asyncpg version: 0.21.0; CockroachDB version: ...
Read more >
Known Limitations in CockroachDB v22.2
If the number of columns has increased, the prepared statement returns an error but nonetheless writes the data. If the number of columns...
Read more >
SQL Statements | CockroachDB Docs
View the CREATE statement for a database, function, sequence, table, or view. SHOW DATABASES, List databases in the cluster. SHOW ENUMS, List user-defined, ......
Read more >
ENUM | CockroachDB Docs
A user-defined ENUM data type consists of a set of enumerated, static values. Syntax. To declare a new ENUM data type, use CREATE...
Read more >
Build a Simple CRUD Java App with CockroachDB and JDBC
Learn how to use CockroachDB from a simple Java application with the JDBC ... the args and insert them into the // prepared...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found