Skip to content

pg_table_is_visible / obj_description / pg_get_indexdef / pg_get_constraintdef / to_regclass / current_schema() / pg_get_serial_sequence not recognized #2

@ad-m

Description

@ad-m

Repro:

  SELECT pg_catalog.pg_table_is_visible(1);   -- ERROR
  SELECT obj_description(1, 'pg_class');      -- ERROR
  SELECT pg_get_indexdef(1);                  -- ERROR
  SELECT pg_get_constraintdef(1);             -- ERROR
  SELECT to_regclass('public.foo');           -- ERROR
  SELECT current_schema();                    -- ERROR
  SELECT current_database();                  -- ERROR
  SELECT version();                           -- ERROR
  SELECT pg_get_serial_sequence('t','id');    -- ERROR

Expected:

Standard PostgreSQL behavior for each function.

Observed:

All raise psycopg SyntaxError naming the function. The underlying
catalog tables (pg_class, pg_namespace, pg_attribute, pg_type) are
readable, so only the helper functions are missing.

Why it matters:

Django's introspection layer
(django/db/backends/postgresql/introspection.py) emits these from
get_table_list, get_relations, get_constraints, etc. Any ORM-level
test that runs migrate fails immediately. sqlalchemy, alembic, and
asyncpg's introspection helpers similarly depend on these.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions