public inbox for [email protected]  
help / color / mirror / Atom feed
Clarification to catalog-pg-class
10+ messages / 3 participants
[nested] [flat]

* Clarification to catalog-pg-class
@ 2009-01-28 19:18  Josh Berkus <[email protected]>
  0 siblings, 1 reply; 10+ messages in thread

From: Josh Berkus @ 2009-01-28 19:18 UTC (permalink / raw)
  To: pgsql-docs

All,

Currently, catalog-pg-class is a bit confusing as to where FKs are 
tracked in pg_class.  Please update the lines for relchecks and 
reltriggers to read:

relchecks	int2	 	 Number of check constraints on the table (but not 
other types of constraints); see pg_constraint catalog
reltriggers	int2	 	Number of triggers on the table, including 
constraint-triggers for foreign keys; see pg_trigger catalog

--Josh Berkus



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-07 17:05  Bruce Momjian <[email protected]>
  parent: Josh Berkus <[email protected]>
  0 siblings, 1 reply; 10+ messages in thread

From: Bruce Momjian @ 2009-02-07 17:05 UTC (permalink / raw)
  To: Josh Berkus <[email protected]>; +Cc: pgsql-docs

Josh Berkus wrote:
> All,
> 
> Currently, catalog-pg-class is a bit confusing as to where FKs are 
> tracked in pg_class.  Please update the lines for relchecks and 
> reltriggers to read:
> 
> relchecks	int2	 	 Number of check constraints on the table (but not 
> other types of constraints); see pg_constraint catalog

Uh, why do we have to say "but" when we clearly say "check constraints"?
Do we need to say "CHECK" contraints?

> reltriggers	int2	 	Number of triggers on the table, including 
> constraint-triggers for foreign keys; see pg_trigger catalog

pg_class doesn't have that column anymore, it has relhastriggers.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-07 19:04  Josh Berkus <[email protected]>
  parent: Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 10+ messages in thread

From: Josh Berkus @ 2009-02-07 19:04 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: pgsql-docs

Bruce,

>> Currently, catalog-pg-class is a bit confusing as to where FKs are 
>> tracked in pg_class.  Please update the lines for relchecks and 
>> reltriggers to read:
>>
>> relchecks	int2	 	 Number of check constraints on the table (but not 
>> other types of constraints); see pg_constraint catalog
> 
> Uh, why do we have to say "but" when we clearly say "check constraints"?
> Do we need to say "CHECK" contraints?

Because I've encountered two people on IRC (and a client) who were 
confused about this, and it confused me briefly when I fielded their 
questions.  Saying "CHECK constraints" would also probably do it, or 
saying "check constraints (only)"

BTW, why do we still have relukeys etc. around?  If we haven't used them 
in 5 versions, shouldn't we purge them?

> 
>> reltriggers	int2	 	Number of triggers on the table, including 
>> constraint-triggers for foreign keys; see pg_trigger catalog
> 
> pg_class doesn't have that column anymore, it has relhastriggers.

Ah.  Where are we tracking FKs at this point, then?

--Josh




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-07 19:29  Bruce Momjian <[email protected]>
  parent: Josh Berkus <[email protected]>
  0 siblings, 2 replies; 10+ messages in thread

From: Bruce Momjian @ 2009-02-07 19:29 UTC (permalink / raw)
  To: Josh Berkus <[email protected]>; +Cc: pgsql-docs

Josh Berkus wrote:
> Bruce,
> 
> >> Currently, catalog-pg-class is a bit confusing as to where FKs are 
> >> tracked in pg_class.  Please update the lines for relchecks and 
> >> reltriggers to read:
> >>
> >> relchecks	int2	 	 Number of check constraints on the table (but not 
> >> other types of constraints); see pg_constraint catalog
> > 
> > Uh, why do we have to say "but" when we clearly say "check constraints"?
> > Do we need to say "CHECK" contraints?
> 
> Because I've encountered two people on IRC (and a client) who were 
> confused about this, and it confused me briefly when I fielded their 
> questions.  Saying "CHECK constraints" would also probably do it, or 
> saying "check constraints (only)"

Uppercase done, with <literal> tag.

> BTW, why do we still have relukeys etc. around?  If we haven't used them 
> in 5 versions, shouldn't we purge them?

Uh, that one is gone now:

	      Table "pg_catalog.pg_class"
	     Column     |   Type    | Modifiers
	----------------+-----------+-----------
	 relname        | name      | not null
	 relnamespace   | oid       | not null
	 reltype        | oid       | not null
	 relowner       | oid       | not null
	 relam          | oid       | not null
	 relfilenode    | oid       | not null
	 reltablespace  | oid       | not null
	 relpages       | integer   | not null
	 reltuples      | real      | not null
	 reltoastrelid  | oid       | not null
	 reltoastidxid  | oid       | not null
	 relhasindex    | boolean   | not null
	 relisshared    | boolean   | not null
	 relkind        | "char"    | not null
	 relnatts       | smallint  | not null
	 relchecks      | smallint  | not null
	 relhasoids     | boolean   | not null
	 relhaspkey     | boolean   | not null
	 relhasrules    | boolean   | not null
	 relhastriggers | boolean   | not null
	 relhassubclass | boolean   | not null
	 relfrozenxid   | xid       | not null
	 relacl         | aclitem[] |
	 reloptions     | text[]    |

> 
> > 
> >> reltriggers	int2	 	Number of triggers on the table, including 
> >> constraint-triggers for foreign keys; see pg_trigger catalog
> > 
> > pg_class doesn't have that column anymore, it has relhastriggers.
> 
> Ah.  Where are we tracking FKs at this point, then?

The count was only used to determine if we should check for triggers, so
we now use a boolean;  the code checks are the same.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-07 19:37  Josh Berkus <[email protected]>
  parent: Bruce Momjian <[email protected]>
  1 sibling, 1 reply; 10+ messages in thread

From: Josh Berkus @ 2009-02-07 19:37 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: pgsql-docs


> The count was only used to determine if we should check for triggers, so
> we now use a boolean;  the code checks are the same.

Hmmm.  In the beta publicity and release notes, we should warn tool 
designers about this.  It's quite possible that some of them (SQLManger, 
etc.) were using the counts for something.  No reason to surprise them.

--Josh




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-07 20:12  Bruce Momjian <[email protected]>
  parent: Josh Berkus <[email protected]>
  0 siblings, 0 replies; 10+ messages in thread

From: Bruce Momjian @ 2009-02-07 20:12 UTC (permalink / raw)
  To: Josh Berkus <[email protected]>; +Cc: pgsql-docs

Josh Berkus wrote:
> 
> > The count was only used to determine if we should check for triggers, so
> > we now use a boolean;  the code checks are the same.
> 
> Hmmm.  In the beta publicity and release notes, we should warn tool 
> designers about this.  It's quite possible that some of them (SQLManger, 
> etc.) were using the counts for something.  No reason to surprise them.

Well, we have never documented system table changes in any previous
release, and never got a request to document them either.

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-11 09:23  Peter Eisentraut <[email protected]>
  parent: Bruce Momjian <[email protected]>
  1 sibling, 1 reply; 10+ messages in thread

From: Peter Eisentraut @ 2009-02-11 09:23 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: Josh Berkus <[email protected]>; pgsql-docs

Bruce Momjian wrote:
> Josh Berkus wrote:
>> Bruce,
>>
>>>> Currently, catalog-pg-class is a bit confusing as to where FKs are 
>>>> tracked in pg_class.  Please update the lines for relchecks and 
>>>> reltriggers to read:
>>>>
>>>> relchecks	int2	 	 Number of check constraints on the table (but not 
>>>> other types of constraints); see pg_constraint catalog
>>> Uh, why do we have to say "but" when we clearly say "check constraints"?
>>> Do we need to say "CHECK" contraints?
>> Because I've encountered two people on IRC (and a client) who were 
>> confused about this, and it confused me briefly when I fielded their 
>> questions.  Saying "CHECK constraints" would also probably do it, or 
>> saying "check constraints (only)"
> 
> Uppercase done, with <literal> tag.

This is inconsistent with the rest of the documentation.




^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-12 03:17  Bruce Momjian <[email protected]>
  parent: Peter Eisentraut <[email protected]>
  0 siblings, 1 reply; 10+ messages in thread

From: Bruce Momjian @ 2009-02-12 03:17 UTC (permalink / raw)
  To: Peter Eisentraut <[email protected]>; +Cc: Josh Berkus <[email protected]>; pgsql-docs

Peter Eisentraut wrote:
> Bruce Momjian wrote:
> > Josh Berkus wrote:
> >> Bruce,
> >>
> >>>> Currently, catalog-pg-class is a bit confusing as to where FKs are 
> >>>> tracked in pg_class.  Please update the lines for relchecks and 
> >>>> reltriggers to read:
> >>>>
> >>>> relchecks	int2	 	 Number of check constraints on the table (but not 
> >>>> other types of constraints); see pg_constraint catalog
> >>> Uh, why do we have to say "but" when we clearly say "check constraints"?
> >>> Do we need to say "CHECK" contraints?
> >> Because I've encountered two people on IRC (and a client) who were 
> >> confused about this, and it confused me briefly when I fielded their 
> >> questions.  Saying "CHECK constraints" would also probably do it, or 
> >> saying "check constraints (only)"
> > 
> > Uppercase done, with <literal> tag.
> 
> This is inconsistent with the rest of the documentation.

Should I use <emphasis>?  <literal>?

-- 
  Bruce Momjian  <[email protected]>        http://momjian.us
  EnterpriseDB                             http://enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-13 09:13  Peter Eisentraut <[email protected]>
  parent: Bruce Momjian <[email protected]>
  0 siblings, 1 reply; 10+ messages in thread

From: Peter Eisentraut @ 2009-02-13 09:13 UTC (permalink / raw)
  To: Bruce Momjian <[email protected]>; +Cc: Josh Berkus <[email protected]>; pgsql-docs

Bruce Momjian wrote:
> Peter Eisentraut wrote:
>> Bruce Momjian wrote:
>>> Josh Berkus wrote:
>>>> Bruce,
>>>>
>>>>>> Currently, catalog-pg-class is a bit confusing as to where FKs are 
>>>>>> tracked in pg_class.  Please update the lines for relchecks and 
>>>>>> reltriggers to read:
>>>>>>
>>>>>> relchecks	int2	 	 Number of check constraints on the table (but not 
>>>>>> other types of constraints); see pg_constraint catalog
>>>>> Uh, why do we have to say "but" when we clearly say "check constraints"?
>>>>> Do we need to say "CHECK" contraints?
>>>> Because I've encountered two people on IRC (and a client) who were 
>>>> confused about this, and it confused me briefly when I fielded their 
>>>> questions.  Saying "CHECK constraints" would also probably do it, or 
>>>> saying "check constraints (only)"
>>> Uppercase done, with <literal> tag.
>> This is inconsistent with the rest of the documentation.
> 
> Should I use <emphasis>?  <literal>?

<emphasis> would be appropriate, but I personally don't really buy the 
premise.  If we had to highlight every idiosyncracy in the catalog 
fields, it would end up looking quite colorful.

I suppose a more constructive point would be, where are the other 
constraint types kept track of?



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Clarification to catalog-pg-class
@ 2009-02-13 18:22  Josh Berkus <[email protected]>
  parent: Peter Eisentraut <[email protected]>
  0 siblings, 0 replies; 10+ messages in thread

From: Josh Berkus @ 2009-02-13 18:22 UTC (permalink / raw)
  To: Peter Eisentraut <[email protected]>; +Cc: Bruce Momjian <[email protected]>; pgsql-docs

Peter,

> I suppose a more constructive point would be, where are the other 
> constraint types kept track of?

AFAICT, we're not tracking them in pg_class at all anymore, except that 
FKs will set relhastrigger=true in the absensce of any other triggers.

The confusion on this particular line is caused by the "see 
pg_constraint catalog", which covers *all* constraints, whereas 
relconstrains only counts the CHECK constraints and not other types. 
That's why I think a small emphasis on CHECK would prevent people from 
being confused again.

Of course, at this point, we've spent more time discussing the issue 
than people have been confused by it, probably.

--Josh





^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2009-02-13 18:22 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2009-01-28 19:18 Clarification to catalog-pg-class Josh Berkus <[email protected]>
2009-02-07 17:05 ` Bruce Momjian <[email protected]>
2009-02-07 19:04   ` Josh Berkus <[email protected]>
2009-02-07 19:29     ` Bruce Momjian <[email protected]>
2009-02-07 19:37       ` Josh Berkus <[email protected]>
2009-02-07 20:12         ` Bruce Momjian <[email protected]>
2009-02-11 09:23       ` Peter Eisentraut <[email protected]>
2009-02-12 03:17         ` Bruce Momjian <[email protected]>
2009-02-13 09:13           ` Peter Eisentraut <[email protected]>
2009-02-13 18:22             ` Josh Berkus <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox