pg_tables view definition incorrect??

Started by Mike Quinnalmost 23 years ago3 messagesbugs
Jump to latest
#1Mike Quinn
mquinn@co.merced.ca.us

version
---------------------------------------------------------------
PostgreSQL 7.3.2 on i586-pc-linux-gnu, compiled by GCC 2.95.3
(1 row)

View "pg_catalog.pg_tables"
Column | Type | Modifiers
-------------+---------+-----------
schemaname | name |
tablename | name |
tableowner | name |
hasindexes | boolean |
hasrules | boolean |
hastriggers | boolean |
View definition: SELECT n.nspname AS schemaname, c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, (c.reltriggers > 0) AS hastriggers FROM (pg_class c LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 's'::"char"));

Given that 'S' => Sequence and 's' => special shouldn't the last condition in the WHERE clause be:

c.relkind = 'S'::"char"

instead of

c.relkind = 's'::"char"

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Mike Quinn (#1)
Re: pg_tables view definition incorrect??

"Mike Quinn" <mquinn@co.merced.ca.us> writes:

Given that 'S' => Sequence and 's' => special shouldn't the last condition in the WHERE clause be:
c.relkind = 'S'::"char"

Only if you suppose that pg_tables should show sequences, which was not
the intention. (I'm not real sure why 's' relations are listed, since
they're not really tables either, but the view is operating as
designed.)

I'm prepared to listen to an argument that pg_tables should show
sequences, but that's a definition change not a bug fix. Want to
bring it up on -general or -hackers?

regards, tom lane

#3Bruce Momjian
bruce@momjian.us
In reply to: Mike Quinn (#1)
Re: [BUGS] pg_tables view definition incorrect??

You are correct. Patch attached and applied.

---------------------------------------------------------------------------

Mike Quinn wrote:

version
---------------------------------------------------------------
PostgreSQL 7.3.2 on i586-pc-linux-gnu, compiled by GCC 2.95.3
(1 row)

View "pg_catalog.pg_tables"
Column | Type | Modifiers
-------------+---------+-----------
schemaname | name |
tablename | name |
tableowner | name |
hasindexes | boolean |
hasrules | boolean |
hastriggers | boolean |
View definition: SELECT n.nspname AS schemaname, c.relname AS tablename, pg_get_userbyid(c.relowner) AS tableowner, c.relhasindex AS hasindexes, c.relhasrules AS hasrules, (c.reltriggers > 0) AS hastriggers FROM (pg_class c LEFT JOIN pg_namespace n ON ((n.oid = c.relnamespace))) WHERE ((c.relkind = 'r'::"char") OR (c.relkind = 's'::"char"));

Given that 'S' => Sequence and 's' => special shouldn't the last condition in the WHERE clause be:

c.relkind = 'S'::"char"

instead of

c.relkind = 's'::"char"

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

Attachments:

/bjm/difftext/plainDownload+2-2