microsoft / azuredatastudio-postgresql

azuredatastudio-postgresql is an extension for Azure Data Studio that enables you to work with PostgreSQL databases
Other
196 stars 37 forks source link

Error Executing on Cockroach DB #95

Open cretz opened 5 years ago

cretz commented 5 years ago

The application works well on cockroach except the actual query part. When querying I get:

Started executing query at Line 1
syntax error at or near "declare"
Total execution time: 00:00:00.002

I understand if this will be closed because cockroach is not a target, but I would hope it could be considered as it's quite compatible to psql. Curious what is the actual underlying query sent? And I've tried setting pgsql.logDebugInfo to true but not getting what is sent, is there a way to see it? I assume it's declaring a cursor, is there a setting to not use cursors?

kevcunnane commented 5 years ago

The issue is in the SelectBatch class:

        return connection.cursor(name=cursor_name, withhold=True)

Turns out CockroachDB doesn't support this parameter - see E121-17 in this doc. I'm guessing we need this for autocommit + get result sets?

Full error is syntax error at or near "declare" DETAIL: source SQL: DECLARE "ce0ac742-cb5b-44dd-ac90-df2d1cd368e2" CURSOR WITH HOLD FOR select 1 ^

Note: would be nice to get inner error here as the basic one is not useful to users.

Long term, maybe see if in this case we could detect CockroachDB and tweak some settings to handle this. Note that intellisense also croaks on this DB type, as does scripting. But basic object explorer is fine.

bladefist commented 4 years ago

Is this something that will ever happen?