Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pg] Fix INTERNAL ERROR for psql \d command - list tables #1735

Closed
Tracked by #1734
rekby opened this issue Feb 8, 2024 · 1 comment · Fixed by #1893
Closed
Tracked by #1734

[pg] Fix INTERNAL ERROR for psql \d command - list tables #1735

rekby opened this issue Feb 8, 2024 · 1 comment · Fixed by #1893
Labels
area/pg bug Something isn't working

Comments

@rekby
Copy link
Member

rekby commented Feb 8, 2024

Reproduce:

  1. Run local_ydb with postgres experiment enabled https://github.com/ydb-platform/ydb/wiki/Local-run-postgres-tests
  2. Connect to YDB with psql: psql postgres://root:1234@localhost:5432/local
  3. echo '\d' | psql postgres://root:1234@localhost:5432/local
Query from psql

SELECT n.nspname as "Schema",
  c.relname as "Name",
  CASE c.relkind WHEN 'r' THEN 'table' WHEN 'v' THEN 'view' WHEN 'm' THEN 'materialized view' WHEN 'i' THEN 'index' WHEN 'S' THEN 'sequence' WHEN 's' THEN 'special' WHEN 't' THEN 'TOAST table' WHEN 'f' THEN 'foreign table' WHEN 'p' THEN 'partitioned table' WHEN 'I' THEN 'partitioned index' END as "Type",
  pg_catalog.pg_get_userbyid(c.relowner) as "Owner"
FROM pg_catalog.pg_class c
     LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
     LEFT JOIN pg_catalog.pg_am am ON am.oid = c.relam
WHERE c.relkind IN ('r','p','v','m','S','f','')
      AND n.nspname <> 'pg_catalog'
      AND n.nspname !~ '^pg_toast'
      AND n.nspname <> 'information_schema'
  AND pg_catalog.pg_table_is_visible(c.oid)
ORDER BY 1,2;

Error

Status: INTERNAL_ERROR
Issues:
<main>: Fatal: ydb/library/yql/parser/pg_wrapper/comp_factory.cpp:456: Condition violated: `f', code: 1
<main>: Error: Query invalidated on scheme/internal error., code: 2019

@vitstn
Copy link
Collaborator

vitstn commented Feb 13, 2024

with PR:

local=> \d
Did not find any relations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/pg bug Something isn't working
Projects
None yet
2 participants