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 when disconnecting from Postgres 15.0 connection #334

Closed bwong365 closed 1 year ago

bwong365 commented 1 year ago

From Azure Data Studio:

Failed to close OE session: column db.datlastsysoid does not exist.

On the Postgres side:

2022-10-19 19:03:14.467 UTC [189] ERROR:  column db.datlastsysoid does not exist at character 106
2022-10-19 19:03:14.467 UTC [189] STATEMENT:  
SELECT
    db.oid as oid, 
    db.datname as name, 
    ta.spcname as spcname, 
    db.datallowconn,
    db.datlastsysoid,
    has_database_privilege(db.oid, 'CREATE') as cancreate, 
    datdba as owner, 
    db.datistemplate , 
    has_database_privilege(db.datname, 'connect') as canconnect,
    datistemplate as is_system

FROM
    pg_database db
    LEFT OUTER JOIN pg_tablespace ta ON db.dattablespace = ta.oid
 ORDER BY datname;
jonashilmersson commented 1 year ago

+1

dtwilliams10 commented 1 year ago

+1

Aidan-Chang commented 1 year ago

I fixed it locally. go to %USERPROFILE%.azuredatastudio\extensions\microsoft.azuredatastudio-postgresql-0.2.7 find nodes.sql file in the sub directory out\ossdbtoolsservice\Windows\v1.5.0\pgsqltoolsservice\lib\pgsmo\objects\database\templates+default\

change db.datlastsysoid, to 0 as datlastsysoid, in the sql text. save and reopen the azure data studio

wehnertb commented 1 year ago

+1 - Thank you! - I was getting this when trying to expand databases in tree.

jammerware commented 1 year ago

I fixed it locally. go to %USERPROFILE%.azuredatastudio\extensions\microsoft.azuredatastudio-postgresql-0.2.7 find nodes.sql file in the sub directory out\ossdbtoolsservice\Windows\v1.5.0\pgsqltoolsservice\lib\pgsmo\objects\database\templates+default\

change db.datlastsysoid, to 0 as datlastsysoid, in the sql text. save and reopen the azure data studio

This was really helpful, thank you! For anyone for whom this doesn't fix it, note that you may have to do a little more depending on... factors I don't really understand as a Postgres newbie 🤣 See my comment here.

aaronschendel commented 1 year ago

0 as datlastsysoid,

This fixed my issue today - thank you!

sanyog2491 commented 1 year ago

I fixed it locally. go to %USERPROFILE%.azuredatastudio\extensions\microsoft.azuredatastudio-postgresql-0.2.7 find nodes.sql file in the sub directory out\ossdbtoolsservice\Windows\v1.5.0\pgsqltoolsservice\lib\pgsmo\objects\database\templates+default\

change db.datlastsysoid, to 0 as datlastsysoid, in the sql text. save and reopen the azure data studio

how to open this m really not getting how to fix using this solution

wehnertb commented 1 year ago

@sanyog2491 - if you navigate to this directory (easiest way is to open File Explorer and past it into the address bar).

%USERPROFILE%.azuredatastudio\extensions\microsoft.azuredatastudio-postgresql-0.2.7\out\ossdbtoolsservice\Windows\v1.5.0\pgsqltoolsservice\lib\pgsmo\objects\database\templates+default

Edit the file "nodes.sql" and you should see a line referencing "datlastsysoid" - you want to change that line to look like this:

0 as datlastsysoid,

Save the file and then open Azure Data Studio again and the issue should be resolved.

RachelAmbler commented 1 year ago

For MacOS this can be found at

~/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.2.7/out/ossdbtoolsservice/OSX/v1.5.0/pgsqltoolsservice/lib/pgsmo/objects/database/templates/+default/nodes.sql

lucadistefano commented 1 year ago

@RachelAmbler @Aidan-Chang thanks it fixed the problem for me too

DaeunYim commented 1 year ago

Tracking from https://github.com/microsoft/azuredatastudio-postgresql/issues/357. Closing the issue