Coder Social home page Coder Social logo

pgtoolsservice's Introduction

Open Source Databases Tools Service

The Open Source Databases Tools Service is an application that provides core functionality for various PostgreSQL Server tools. These features include the following:

  • Connection management
  • Language Service support using VS Code protocol
  • Query execution and resultset management

It is based on the Microsoft SQL Tools Service and pgAdmin.

Support

Support for this extension is provided on our GitHub Issue Tracker. You can submit a bug report, a feature suggestion or participate in discussions.

Contributing to the Extension

See the developer documentation for details on how to contribute to this extension.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Privacy Statement

The Microsoft Enterprise and Developer Privacy Statement describes the privacy statement of this software.

License

This extension is licensed under the MIT License. Please see the third-party notices file for additional copyright notices and license terms applicable to portions of the software.

pgtoolsservice's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pgtoolsservice's Issues

ValueError: dictionary update sequence element #1 has length 1; 2 is required when using username with spaces

The key requirement to reproduce the issue is to use a username (role) having spaces in it.
Something like "DB READER"

The bug was introduced by

self._dsn_parameters = dict(part.split('=') for part in self._conn.info.dsn.split()) if self._conn.info.dsn is not None else {}

In the updated code, the DSN string is being split on whitespace to get individual key-value pairs, which are then split on the equals sign '=' to get the keys and values. The dict function is used to create a dictionary from these keys and values.

However this doesn't work for situations when there are spaces inside values.

@nasc17 FYI

Can be reproduced via the following script

import psycopg
import psycopg2

# Replace these with your actual database credentials
database_credentials = {
    'dbname': 'postgres',
    'user': '<YOUR ROLE NAME WITH SPACES>',
    'password': '<YOUR_AZURE_TOKEN>', #can obtain one using az account get-access-token --resource-type oss-rdbms | jq -r '.accessToken'
    'host': '<YOUR AZURE SERVER NAME>.postgres.database.azure.com',
    'port': 5432
}

try:
    # Connect to the database
    conn = psycopg.connect(**database_credentials)
    conn2 = psycopg2.connect(**database_credentials)

    # Print the DSN and the result of splitting the DSN
    print("(before changes) psycopg2 DSN using .get_dsn_parameters():", conn2.get_dsn_parameters())
    print("(after changes) psycopg DSN:", conn.info.dsn)
    # the following line is going to fail with ValueError
    print("(after changes) psycopg DSN dict via split():", dict(part.split('=') for part in conn.info.dsn.split()) if conn.info.dsn is not None else {})

except psycopg.Error as e:
    print("Unable to connect to the database")
    print(e)

finally:
    # Make sure to close the connection to avoid leaking resources
    if 'conn' in locals():
        conn.close()
    # Make sure to close the connection to avoid leaking resources
    if 'conn2' in locals():
        conn2.close()    

image

microsoft/azuredatastudio-postgresql#434

Cannot connect to postgresql running local on MacOS

  • MacOS 10.13.6
  • PostgreSQL 11.2 listening on 127.0.0.1:5432 (installed with homebrew)
  • Azure Data Studio 1.5.1

I am trying to connect to the local PostgreSQL and following messages are displayed:

[Error - XXX] Connection to server got closed. Server will not be restarted.
[Error - XXX] Request connection/connect failed.
Error: Connection got disposed.
at Object.dispose (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/main.js:825:25)
at Object.dispose (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-languageclient/lib/client.js:57:35)
at SqlOpsDataClient.handleConnectionClosed (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-languageclient/lib/client.js:1864:38)
at SqlOpsDataClient.handleConnectionClosed (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-languageclient/lib/main.js:106:15)
at closeHandler (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-languageclient/lib/client.js:1852:18)
at CallbackList.invoke (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/events.js:71:39)
at Emitter.fire (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/events.js:135:36)
at closeHandler (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/main.js:221:26)
at CallbackList.invoke (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/events.js:71:39)
at Emitter.fire (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/events.js:135:36)
at StreamMessageWriter.AbstractMessageWriter.fireClose (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/messageWriter.js:57:27)
at Socket. (/Users/XXX/.azuredatastudio/extensions/microsoft.azuredatastudio-postgresql-0.1.0/node_modules/vscode-jsonrpc/lib/messageWriter.js:79:63)
at emitOne (events.js:116:13)
at Socket.emit (events.js:211:7)
at Pipe.Socket._destroy.cb._handle.close [as _onclose] (net.js:554:12)

PostgreSQL in Azure Data Studio has a trouble

I use Data Studio in Ubuntu 20.04.3 LTS, and, When I open Data Studio, I got a message on Exit Console:

It seems the debugger cannot resolve /opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/posixpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193
Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/startup.py", line 40, in run
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 11, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/init.py", line 13, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/force_pydevd.py", line 37, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/init.py", line 123, in preimport
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/importlib/init.py", line 126, in import_module
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/pydevd.py", line 31, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/_pydevd_bundle/pydevd_utils.py", line 8, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/ctypes/init.py", line 7, in
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 01:10:27] Connection to server got closed. Server will not be restarted.

With PostgreSQL, I'm having this trouble described above. I tried to fix this issue searching on Stackoverflow, Reddit or searching...
But, not in SQL Server! It's OK!
Please, can Anyone help me?

No module named 'pgsqltoolsservice.language.completion.packages'

Running Azure Data Studio 1.12.1 (user install):

Version: 1.12.1 (user setup)
Commit: cccb9327c707fe71de24d5ce655acb29cc8946d1
Date: 2019-10-07T21:49:53.568Z
VS Code 1.37.0
Electron: 4.2.9
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.16299

I searched for the Postgres extension and enabled it. Azure Data Studio tells me it is installed:

Name: PostgreSQL
Id: microsoft.azuredatastudio-postgresql
Description: PostgreSQL extension for Azure Data Studio
Version: 0.2.2
Publisher: Microsoft
VS Marketplace Link: undefined?itemName=Microsoft.azuredatastudio-postgresql

But when it installed (and everytime I restart Azure Data Studio), I get this error:

Traceback (most recent call last):
  File "C:\hostedtoolcache\windows\Python\3.6.8\x64\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 14, in run
  File "C:\hostedtoolcache\windows\Python\3.6.8\x64\lib\site-packages\cx_Freeze\initscripts\Console.py", line 26, in run
  File "pgsqltoolsservice/pgtoolsservice_main.py", line 18, in <module>
  File "D:\a\1\s\pgsqltoolsservice\language\__init__.py", line 6, in <module>
  File "D:\a\1\s\pgsqltoolsservice\language\language_service.py", line 32, in <module>
  File "D:\a\1\s\pgsqltoolsservice\language\completion\__init__.py", line 6, in <module>
  File "D:\a\1\s\pgsqltoolsservice\language\completion\pgcompleter.py", line 20, in <module>
ModuleNotFoundError: No module named 'pgsqltoolsservice.language.completion.packages'
[Error - 3:51:27 p.m.] Connection to server got closed. Server will not be restarted.

Although the connection type Postgres now shows, it just loops forever trying to connect. I can connect just fine usign psql or HeidiSQL.

Error when using with Remote SSH

Initializing PostgreSQL tools service for the PostgreSQL extension.
Note: PostgreSQL commands will be available after installing the service.

Platform-------------: linux, x86_64, name=ubuntu, version=16.04 (Ubuntu16)


Installing PostgreSQL tools service to /apps/.vscode-server-insiders/extensions/ms-ossdata.vscode-postgresql-0.3.0/pgsqltoolsservice/v1.4.0/Ubuntu16.
Downloading https://github.com/Microsoft/pgtoolsservice/releases/download/v1.4.0/pgsqltoolsservice-linux-x64.tar.gz
[ERROR] Error: Request error: EPROTO

Update to v1.3.0 clears saved passwords

This morning Azure Data Studio automatically installed version 1.3.0 of pgtoolsservice.
When I try to open my saved connections for which I also have the passwords saved I get the following connection error "fe_sendauth: no password supplied"
Looking at the connection information I notice that the update apparently cleared all the password fields and remember password check-boxes.

column rel.relhasoids does not exist

Azure Data Studio - 1.28
PostgreSQL extension - 0.2.7
PGToolsService - 1.5
Postgres - 12.7

When trying to script out an existing table from within Azure Data Studio, you get an error stating the following;
Code: 0
[object Object]
[Error - 14:02:33] Request scripting/script failed.
Message: column rel.relhasoids does not exist
LINE 8: pg_get_userbyid(rel.relowner) AS relowner, rel.relhasoids,

Upon further investigation the issue is to do with this - https://postgresql.verite.pro/blog/2019/04/24/oid-column.html

Commenting out the column in the following file resolves the issue; https://github.com/microsoft/pgtoolsservice/blob/master/pgsmo/objects/table/templates/9.1_plus/properties.sql

However I suspect that is more of a hack than a fix.

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

Hi,

I am getting this error when trying to install PostgreSQL extension:

ImportError: libffi.so.6: cannot open shared object file: No such file or directory

More details:

It seems the debugger cannot resolve /opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/posixpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
  File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 11, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/__init__.py", line 13, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/force_pydevd.py", line 37, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/__init__.py", line 123, in preimport
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/importlib/__init__.py", line 126, in import_module
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/pydevd.py", line 31, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 11:11:22 AM] Connection to server got closed. Server will not be restarted.

OS: Ubuntu 20.04.1 LTS
Azure Data Studio: Version: 1.25.1
Commit: e7eacc32c0d20bd4da843320c3bfac231b308c98
Date: 2020-12-11T01:51:41.708Z
VS Code: 1.48.0
Electron: 9.3.0
Chrome: 83.0.4103.122
Node.js: 12.14.1
V8: 8.3.110.13-electron.0
OS: Linux x64 5.4.0-58-generic

Any help or guidance is much appreciated. Thank you.

Connection to server got closed. Server will not be restarted.

On my Ubuntu 2004, this error is present.

This occurs when I am installing extensions (Admin Tools and PostgresSQL)

Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/startup.py", line 14, in run
File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/Console.py", line 26, in run
File "pgsqltoolsservice/pgtoolsservice_main.py", line 11, in
File "/usr/local/lib/python3.6/dist-packages/ptvsd/init.py", line 17, in
File "/usr/local/lib/python3.6/dist-packages/ptvsd/attach_server.py", line 35, in
File "/usr/local/lib/python3.6/dist-packages/ptvsd/visualstudio_py_debugger.py", line 24, in
File "/usr/lib/python3.6/ctypes/init.py", line 7, in
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 19:59:23] Connection to server got closed. Server will not be restarted.

"OSS DB Tools Service component exited unexpectedly. Please restart Azure Data Studio" on Arch Linux

I have fixed this on my local. I had to install libxcrypt-compat.
The traceback on my local was:

❯ cat .config/azuredatastudio/logs/20230404T110300/exthost1/output_logging_20230404T110303/6-ossdbToolsService.log
It seems the debugger cannot resolve /opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/posixpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
  File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 13, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/admin/__init__.py", line 6, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/admin/admin_service.py", line 8, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/connection/__init__.py", line 6, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/connection/connection_service.py", line 29, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/driver/__init__.py", line 6, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/driver/types/__init__.py", line 7, in <module>
  File "/home/vsts/work/1/s/ossdbtoolsservice/driver/types/psycopg_driver.py", line 8, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/psycopg2/__init__.py", line 50, in <module>
ImportError: libcrypt.so.1: cannot open shared object file: No such file or directory
[Error - 11:03:04 AM] Connection to server got closed. Server will not be restarted.

system catalog changes in Postgres 11

When connecting to Postgresql 11, the queries for function definitions (pg_catalog.pg_proc) are out of date, and thus fail to load.

Eg. https://github.com/Microsoft/pgtoolsservice/blob/master/pgsmo/objects/functions/templates_functions/pg/+default/nodes.sql#L28

An example of how pgadmin has fixed this can be found at
https://github.com/postgres/pgadmin4/blob/master/web/pgadmin/browser/server_groups/servers/databases/schemas/functions/templates/functions/pg/sql/11_plus/node.sql

Error querying unbounded numrange

Hi, my name is Eliseu.
I'm getting an error on azuredatastudio when I run any query on postgresql using unbounded numrange type.
Examples:
SELECT numrange(1, NULL);

SELECT numrange(NULL, 1);

SELECT numrange(NULL, NULL);

SELECT '(,1]'::numrange;

SELECT '[1,)'::numrange;

CREATE TABLE test (
field1 numrange
);
INSERT INTO test (field1) VALUES (numrange(1, NULL))
SELECT * FROM test;

all these querys throw the same error:
Unhandled exception while executing query: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

I tested and they all work on psql, postbird, dbeaver.

I'm using the version 0.2.4 of the extension and version 1.15.1 of azure data studio.

The postgres I'm using is the official docker image (https://hub.docker.com/_/postgres)

This error repeated in 3 different machines (two running linux, one with windows) I've seem so far.

Let me know if more information is needed

error-azuredatastudio

error in openSUSE Tumbleweed

Module not working in openSUSE Tumbleweed.

Just after install the plugin got the error below:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/Console.py", line 26, in run
  File "pgsqltoolsservice/pgtoolsservice_main.py", line 11, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/__init__.py", line 17, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/attach_server.py", line 35, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/visualstudio_py_debugger.py", line 24, in <module>
  File "/usr/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 15:36:08] Connection to server got closed. Server will not be restarted.

Installed version of libffi:

$ rpm -qa | grep libffi
libffi7-32bit-3.2.1.git259-6.8.x86_64
libffi7-3.2.1.git259-6.8.x86_64
libffi-devel-3.2.1.git259-6.8.x86_64

Error: "PostgreSQL Tools Service component could not start"

Upon installing the extension and trying the "New Query" command I get this error:

2023-07-30_09MS+0200_573x162

and this log from the SqlToolsService initialization:

Initializing PostgreSQL tools service for the PostgreSQL extension.
Note: PostgreSQL commands will be available after installing the service.

Platform-------------: linux, x86_64, name=debian, version=12 (Debian)


Installing PostgreSQL tools service to /home/vscode/.vscode-server/extensions/ms-ossdata.vscode-postgresql-0.3.0/pgsqltoolsservice/v1.4.0/Debian.
Downloading https://github.com/Microsoft/pgtoolsservice/releases/download/v1.4.0/pgsqltoolsservice-linux-x64.tar.gz
(21369 KB) .................... Done!
Installing ...
Done! 1804 files unpacked.

no query editor shows up.

Environment

devcontainer: mcr.microsoft.com/devcontainers/rust:1-1-bookworm

Error on startup

Hi.

I am running Kubuntu 20. Azure Data Studio installed from deb.

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
  File "/usr/local/lib/python3.6/dist-packages/cx_Freeze/initscripts/Console.py", line 26, in run
  File "pgsqltoolsservice/pgtoolsservice_main.py", line 11, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/__init__.py", line 17, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/attach_server.py", line 35, in <module>
  File "/usr/local/lib/python3.6/dist-packages/ptvsd/visualstudio_py_debugger.py", line 24, in <module>
  File "/usr/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 1:11:10 PM] Connection to server got closed. Server will not be restarted.

Postgres Intellisense suggestions appear in T-SQL

Issue Type: Bug

  1. Install the PG extension.

  2. Set your IntelliSense (aka Intelli Sense) preferences for MSSQL to be lowercase.

image

  1. Restart ADS

  2. Attach to a MS SQL DB and create a new query.

  3. Type "sel" - Note that IntelliSense shows both the MSSQL select suggestion and the PSQL SELECT suggestion.

image

Azure Data Studio version: Azure Data Studio 1.7.0-insider (34457880c77068d787021329d2d55cea94aabe74, 2019-04-25T07:14:36.294Z)
OS version: Darwin x64 18.5.0

System Info
Item Value
CPUs Intel(R) Core(TM) M-5Y51 CPU @ 1.10GHz (4 x 1200)
GPU Status 2d_canvas: enabled
checker_imaging: disabled_off
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: enabled
rasterization: enabled
surface_synchronization: enabled_on
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 1, 2, 2
Memory (System) 8.00GB (0.58GB free)
Process Argv
Screen Reader no
VM 0%

PostgreSQL extension python 3.6 package dependency issue

Using Manjaro Linux x86_64, the following issue is produced when enabling the PostgreSQL extension. Manjaro Linux is currently running python 3.9.6

It seems the debugger cannot resolve /opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/posixpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
  File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 11, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/__init__.py", line 13, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/force_pydevd.py", line 37, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/__init__.py", line 123, in preimport
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/importlib/__init__.py", line 126, in import_module
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/pydevd.py", line 31, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 3:56:17 PM] Connection to server got closed. Server will not be restarted.

PostgreSQL Extension on Azure Data Studio Linux version

Hi,

I'm having issues with the PostgreSQL extension on Azure Data Studio.

Extension version: PostgreSQL v0.2.7

Azure Data Studio version:

Version: 1.43.0
Commit: b790d700898b1095d83e62f0de14678a58222520
Date: 2023-04-10T23:08:07.209Z
VS Code: 1.67.0
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Linux x64 5.4.0-148-generic (Linux Mint 20.04 64bit)

The extension is active and everytime i start Azure Data Studio, on the right lower corner of the screen, it shows the error message:

OSS DB Tools Service component exited unexpectedly.
Please restart Azure Data Studio.
Source: PostgreSQL (Extension)

I've restarted several times and it shows the same message everytime.
The only way to stop this message from popping up is to disable the extensions PostgreSQL v0.2.7 and Azure PostgreSQL migration v2.0.5, but then i can't use Azure Data Studio for PostgreSQL databases.

Also when these 2 extensions are enabled and I try to create a PostgreSQL connection, it doesn't connect, just stays on a loop trying to connect, doesn't stop, doesn't give any connection error, just keeps on trying to connect until I click cancel.

Any idea what might be causing this behavior?

Thank you very much.

Ricardo,

error occurred when I try to install postgreSQL extension

It seems the debugger cannot resolve /opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/posixpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
  File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 11, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/__init__.py", line 13, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/force_pydevd.py", line 37, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/__init__.py", line 123, in preimport
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/importlib/__init__.py", line 126, in import_module
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/pydevd.py", line 31, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 9:25:12 am] Connection to server got closed. Server will not be restarted.

Column auto suggestions don't work if a previous select column has an alias

  • PGSQL Extension Version: v0.3.0
  • VSCode Version: v1.51.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. Connect to a Postgres instance using the extension.
  2. Open a new editor and switch language mode to SQL. Use the following query:
    SELECT tablename,
           schemaname,
    
    FROM pg_catalog.pg_tables;
  3. Try to trigger auto-suggestions the third select column in the select query and observe that the suggestions are show as expected.
  4. Open a new editor and switch language mode to SQL. Use the following query:
    SELECT tablename,
           schemaname AS "schema",
    
    FROM pg_catalog.pg_tables;
  5. Try to trigger auto-suggestions the third select column in the select query and observe that the suggestions are not show as expected. In fact, only the snippet suggestions are shown. Not even the keyword suggestions.

Note

I recently noticed this issue with when using PostgreSQL VS code extension in VS code for which I opened an issue in the extension repository. As there's no response there and I somehow guessed the issue is more relevant to be filed in this repository, I'm filing it here. Let me know if this isn't the right place to report this issue. Thanks.

PostgreSQL performance on large non-query files

As noted during a user study the extension has issues with files that have a large number of non-select statements.

  • In many other tools the entire query is run as 1 batch, with the effect you only get 1 resultset out
  • In this tools service each statement is run separately instead. While this preserves all result sets, it means that for a 15,000 statement file (e.g. do 15K inserts) you'll execute 15K serial queries. Against a remote DB like azure (say with 200ms round trip time) this means you would have (15K x 0.2sec = 3000 sec = 50min) just in round trips.

Proposed solution:

  • pgsqltoolsservice/query/query.py, line 66 splits into batches by statement, but later (pgsqltoolsservice/query/batch.py, create_batch line 190) each statement is parsed & select statements treated differently to non-select statements
  • We could just extend the query batching so that it splits on selects but otherwise runs all statements in a single batch. Hence for inserts / other operations it'll run as a single large batch.
    • If you have a file that does, for example, a Create Table, then 15K inserts, then 2 selects, you'll have 3 total network calls to the server (create + 15K inserts, then one for each select).

If you want to get fancier, you can define user setting as follows:

  • (Default) Smart batch. Run all non-select statements in groups, and select statements on their own
  • No batching. Run the entire query as 1 operation and only get 1 possible select statement back
  • Batch per statement. Run with each statement in its own batch.

Error log when connecting to PostgreSQL and MySQL server using ADS

When I connect to postgreSQL server or MySQL server, and the password is already saved, I see below error in the ossdbtoolservice log:

16:13:14,224 INFO Received request id=2 method=connection/connect
16:13:14,227 INFO Received notification method=connection/languageflavorchanged
16:13:14,228 INFO ResponseSuccess message sent id=2 method=None
16:13:15,889 INFO Notification message sent id=None method=connection/complete
16:13:16,021 INFO Received request id=3 method=objectexplorer/createsession
16:13:16,022 INFO ResponseSuccess message sent id=3 method=None
16:13:16,411 INFO Received request id=4 method=objectexplorer/createsession
16:13:16,411 ERROR Object explorer session for objectexplorer://[email protected]:3306:/ already exists!
16:13:16,411 INFO ResponseSuccess message sent id=4 method=None
16:13:17,549 INFO Notification message sent id=None method=objectexplorer/sessioncreated
16:13:17,555 INFO Received request id=5 method=objectexplorer/expand
16:13:17,556 INFO ResponseSuccess message sent id=5 method=None
16:13:17,561 INFO Notification message sent id=None method=objectexplorer/expandCompleted
16:13:18,106 INFO Notification message sent id=None method=textDocument/intelliSenseReady

This error log doesn't show up when password is entered in the edit connection tab before connecting.

Similarly, below info logs can be seen when disconnecting to the server. Looks like connection to the databases is not getting closed when disconnecting to the server.

16:08:03,125 INFO could not close the connection for the database information_schema
16:08:03,125 INFO could not close the connection for the database mysql
16:08:03,125 INFO could not close the connection for the database nakul_test
16:08:03,125 INFO could not close the connection for the database nakul_test1
16:08:03,126 INFO could not close the connection for the database performance_schema
16:08:03,126 INFO could not close the connection for the database sys
16:08:03,126 INFO could not close the connection for the database testdb

Unhandled exception while executing query: 'NoneType' object has no attribute 'isoformat'

I get error Unhandled exception while executing query: 'NoneType' object has no attribute 'isoformat' when running query select tsrange('2019-09-18 22:54:45.938767',null);.

Query for tsrange with finite upper limit works fine, for example, select tsrange('2019-09-18 22:54:45.938767','2019-09-18 22:55:49.5235');

datastudioissue

datastudiorange

These are my data studio installation details:

datastudioabout

Resolve Security Components Issue

|CVE-2022-0155 |follow-redirects 1.14.5 |High | |
|||||
|CVE-2022-21676 |engine.io 4.1.1 |High | |
|||||
|CVE-2022-24785 |moment 2.24.0 |High | |
|||||
|CVE-2022-24785 |moment 2.29.1 |High | |
|||||
|CVE-2022-24999 |qs 6.5.2 |High | |
|||||
|CVE-2022-24999 |qs 6.7.0 |High | |
|||||
|CVE-2022-31129 |moment 2.24.0 |High | |
|||||
|CVE-2022-31129 |moment 2.29.1 |High | |
|||||
|CVE-2022-38900 |decode-uri-component 0.2.0 |High | |
|||||
|CVE-2023-28154 |webpack 5.24.3 |High | |
|||||
|WS-2021-0369 |sqlparse 0.3.0 |High | |
|||||

##[warning]Component Governance detected 40 security related alerts at or above '"High"' severity. Microsoft’s Open Source policy requires that all high and critical security vulnerabilities found by this task be addressed by upgrading vulnerable components. Vulnerabilities in indirect dependencies should be addressed by upgrading the root dependency.
To change the severity threshold or build result, either dismiss the alerts in Component Governance or update the settings of this build task.
Please contact [email protected] with questions.
Took 0.3092606 seconds to query alerts.
Component Governance Alerts: https://mssqltools.visualstudio.com/ae14e11c-7eb2-46af-b588-471e6116d635/_componentGovernance/113627?_a=alerts&typeId=16851176
Component Governance Detection History: https://mssqltools.visualstudio.com/ae14e11c-7eb2-46af-b588-471e6116d635/_componentGovernance/113627?_a=history&typeId=16851176
Because the task was auto injected exit code "Success" was returned in place of exit code "AlertsAboveThreshold"
For more information about configuring the build task please visit: https://aka.ms/cgbuildtaskdocs

"OSS DB Tools Service component exited unexpectedly. Please restart Azure Data Studio." on Mac

Error "OSS DB Tools Service component exited unexpectedly. Please restart Azure Data Studio." started to occur after updating Azure Data Studio to version 1.41.0.

Azure Data Studio version:

Version: 1.41.0
Commit: cf5e0fe1a33709e2a82dc94f42dbe88487803d62
Date: 2023-01-24T17:29:04.297Z (5 days ago)
VS Code: 1.67.0
Electron: 19.1.8
Chromium: 102.0.5005.167
Node.js: 16.14.2
V8: 10.2.154.15-electron.0
OS: Darwin x64 22.2.0

PostgreSQL extension version: 0.2.7

9-ossdbToolsService.log

Fatal Python error: Py_Initialize: unable to load the file system codec
LookupError: no codec search functions registered: can't find encoding

Current thread 0x00007ff859c248c0 (most recent call first):
[Error - 7:59:43 AM] Connection to server got closed. Server will not be restarted.

Error on AzureDataStudio startup after installing PostgreSQL extension on Linux Mint

Hi,
After installing the PostgreSQL extension on AzureDataStudio, I'm getting this error.
My setup is:
OS: Linux Mint 20.1 Ulyssa (Xfce Edition)
Installed AzureDataStudio as a deb package.

It seems the debugger cannot resolve /opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/posixpath.py
This may make the debugger miss breakpoints in the standard library.
Related bug: https://bugs.python.org/issue1180193
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 40, in run
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
  File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 11, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/__init__.py", line 13, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/force_pydevd.py", line 37, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/__init__.py", line 123, in preimport
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/importlib/__init__.py", line 126, in import_module
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/pydevd.py", line 31, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/_pydevd_bundle/pydevd_utils.py", line 8, in <module>
  File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/ctypes/__init__.py", line 7, in <module>
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 10:58:21 am] Connection to server got closed. Server will not be restarted.

Do let me know if you need more information.

Bug in Linux

I'm using Fedora and when installing the extension it gives me the following error.

Traceback (most recent call last):
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/startup.py", line 40, in run
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 37, in run
File "ossdbtoolsservice/ossdbtoolsservice_main.py", line 11, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/init.py", line 13, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/force_pydevd.py", line 37, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/ptvsd/_vendored/init.py", line 123, in preimport
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/importlib/init.py", line 126, in import_module
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/pydevd.py", line 31, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/site-packages/_pydevd_bundle/pydevd_utils.py", line 8, in
File "/opt/hostedtoolcache/Python/3.6.12/x64/lib/python3.6/ctypes/init.py", line 7, in
ImportError: libffi.so.6: cannot open shared object file: No such file or directory
[Error - 11:40:49 p. m.] Connection to server got closed. Server will not be restarted.

Mysql: Unhandled exception: "unpack requires a buffer of 4 bytes"

Azure Data Studio: 1.40.0-insider
Mysql Plugin: 0.2.2
pgtoolsservice: 1.6.1
MySql Server: 5.7.40 (Docker)

Select * from T1 gives the error:

[Error - 00:11:28] Request query/subset failed.
  Message: Unhandled exception while handling request method query/subset: "unpack requires a buffer of 4 bytes"
  Code: -32603 

The table structure:

CREATE TABLE `T1` (
  `c1` int(11) NOT NULL AUTO_INCREMENT,
  `c2` longtext,
  `c3` tinyint(1) NOT NULL,
  `c4` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
  `c5` tinyint(1) NOT NULL,
  `c6` int(11) NOT NULL,
  `c7` longtext,
  `c8` longtext,
  `c9` longtext,
  `c10` longtext,
  `c11` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
  `c12` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
  `c13` varchar(100) CHARACTER SET utf8 DEFAULT NULL,
  `c14` varchar(100) DEFAULT NULL,
  `c15` bit(1) NOT NULL DEFAULT b'0',
  PRIMARY KEY (`c1`)
) ENGINE=InnoDB AUTO_INCREMENT=131 DEFAULT CHARSET=latin1

OSS DB Tools service component exited unexpectedelly using Azure on Ubuntu 18.04

I have a problem to connect my postgreSQL database on Azure, on my Ubuntu 18.04 (Bionic Beaver). I have installed Docker version 20.10.4 and the last version of Azure. The error message is about: "OSS DB Tools service component exited unexpectedelly. Please restart Azure Data Studio". However, I've restarted, updated, upgraded, restarted again (even the PC!), and the error persists. Somebody could help me, please?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.