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

sql: add pg_conversion #26390

Closed
BramGruneir opened this issue Jun 4, 2018 · 0 comments · Fixed by #38869
Closed

sql: add pg_conversion #26390

BramGruneir opened this issue Jun 4, 2018 · 0 comments · Fixed by #38869
Assignees
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)

Comments

@BramGruneir
Copy link
Member

PGAdmin issues the following query:

  SELECT cl.relkind, 
         COALESCE(cin.nspname, cln.nspname) AS nspname, 
         COALESCE(ci.relname, cl.relname) AS relname, 
         cl.relname AS indname 
  FROM pg_class AS cl 
  JOIN pg_namespace AS cln 
    ON cl.relnamespace = cln.oid 
  LEFT JOIN pg_index AS ind 
    ON ind.indexrelid = cl.oid 
  LEFT JOIN pg_class AS ci 
    ON ind.indrelid = ci.oid 
  LEFT JOIN pg_namespace AS cin 
    ON ci.relnamespace = cin.oid 
  WHERE (cl.oid IN (
    SELECT objid 
    FROM pg_shdepend 
    WHERE refobjid = 2901009604::OID
  )) 
  AND (cl.oid > none::OID) 
UNION ALL 
  SELECT 'n', 
         NULL, 
         nspname, 
         NULL 
  FROM pg_namespace AS nsp 
  WHERE (nsp.oid IN (
    SELECT objid 
    FROM pg_shdepend 
    WHERE refobjid = 2901009604::OID
  )) 
  AND (nsp.oid > none::OID) 
UNION ALL 
  SELECT CASE WHEN typtype = 'd' 
           THEN 'd' 
           ELSE 'y' 
        END, 
        NULL, 
        typname, 
        NULL 
  FROM pg_type AS ty 
  WHERE (ty.oid IN (
    SELECT objid 
    FROM pg_shdepend 
    WHERE refobjid = 2901009604::OID
  )) 
  AND (ty.oid > none::OID) 
UNION ALL
  SELECT 'C', 
         NULL, 
         conname, 
         NULL 
  FROM pg_conversion AS co 
  WHERE (co.oid IN (
    SELECT objid 
    FROM pg_shdepend 
    WHERE refobjid = 2901009604::OID
  )) 
  AND (co.oid > none::OID) 
UNION ALL 
  SELECT CASE WHEN prorettype = 2279 
           THEN 'T' 
           ELSE 'p' 
        END, 
        NULL, 
        proname, 
        NULL 
  FROM pg_proc AS pr 
  WHERE (pr.oid IN (
    SELECT objid 
    FROM pg_shdepend 
    WHERE refobjid = 2901009604::OID
  )) 
  AND (pr.oid > none::OID) 
UNION ALL 
  SELECT 'o', 
         NULL, 
         (
           (
             (
               (oprname || '('::TEXT) 
                 || COALESCE(tl.typname, ''::TEXT)
             ) || CASE WHEN (tl.oid IS NOT NULL) AND (tr.oid IS NOT NULL) 
               THEN ','::TEXT END
           ) || COALESCE(tr.typname, ''::TEXT)
          ) || ')'::TEXT, 
          NULL 
  FROM pg_operator AS op 
  LEFT JOIN pg_type AS tl 
    ON tl.oid = op.oprleft 
  LEFT JOIN pg_type AS tr 
    ON tr.oid = op.oprright 
  WHERE (op.oid IN (
    SELECT objid 
    FROM pg_shdepend 
    WHERE refobjid = 2901009604::OID
  )) 
  AND (op.oid > none::OID) 
  ORDER BY 1, 2, 3

See https://www.postgresql.org/docs/current/static/catalog-pg-conversion.html for details.

@BramGruneir BramGruneir added the A-sql-pgcompat Semantic compatibility with PostgreSQL label Jun 4, 2018
@BramGruneir BramGruneir added this to the 2.1 milestone Jun 4, 2018
@BramGruneir BramGruneir self-assigned this Jun 4, 2018
@knz knz mentioned this issue Jun 4, 2018
25 tasks
@knz knz added the C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception) label Jun 5, 2018
@knz knz modified the milestones: 2.1, 2.2 Aug 30, 2018
@petermattis petermattis removed this from the 2.2 milestone Oct 5, 2018
craig bot pushed a commit that referenced this issue Jul 19, 2019
38869: sql: compatibility blitz for pgadmin r=jordanlewis a=jordanlewis

A bunch of small improvements to the catalog, new builtins, and a couple of typing improvements all in the name of making pgadmin work.

And it works okay now! Definitely still some flaws and unsupported things, but at least the default experience isn't completely broken anymore.

Closes #33341.
Closes #23299.
Closes #26389.
Closes #26378.
Closes #26390.
Closes #24747.
Closes #37124.
Updates #25213.

![image](https://user-images.githubusercontent.com/43821/61190353-f17fb980-a668-11e9-947f-d1bc3bb1e75d.png)

Co-authored-by: Jordan Lewis <jordanthelewis@gmail.com>
@craig craig bot closed this as completed in #38869 Jul 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-sql-pgcompat Semantic compatibility with PostgreSQL C-enhancement Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants