Skip to content

psql \d <table> query #168

@sunng87

Description

@sunng87

The \d <tablename> will be translated to query:

SELECT c.oid,
      n.nspname,
      c.relname
    FROM pg_catalog.pg_class c
         LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace
    WHERE c.relname OPERATOR(pg_catalog.~) '^(tablename)$' COLLATE pg_catalog.default
      AND pg_catalog.pg_table_is_visible(c.oid)
    ORDER BY 2, 3;

Currently it's blocked by COLLATE support:

This feature is not implemented: Unsupported ast node in sqltorel: Collate { expr: Value(ValueWithSpan { value: SingleQuotedString("^(clubs)$"), span: Span(Location(1,170)..Location(1,181)) }), collation: ObjectName([Identifier(Ident { value: "pg_catalog", quote_style: None, span: Span(Location(1,190)..Location(1,200)) }), Identifier(Ident { value: "default", quote_style: None, span: Span(Location(1,201)..Location(1,208)) })])

We will need to rewrite the sql to remove COLLATE before it is landed in datafusion (apache/datafusion#9192).

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions