a couple of minor itches: RI Trigger Names, and additional Alter ownerships commands. - Mailing list pgsql-hackers

From Ryan Bradetich
Subject a couple of minor itches: RI Trigger Names, and additional Alter ownerships commands.
Date
Msg-id 1020707520.4639.61.camel@beavis
Whole thread Raw
Responses Re: a couple of minor itches: RI Trigger Names, and  (Ryan Bradetich <rbradetich@uswest.net>)
List pgsql-hackers
Hello postgresql-hackers,

Been a while sine I've particiapated on this list so I wanted to say
thank you for the great product postgresql 7.2.1 is!  I have been 
doing some testing in preperation of a database upgrade from 7.0.3
to 7.2.1 and I have a few small itches to scratch, so I thought I'd
get opinions from the experts :)


Itch #1: Referential Integrity trigger names in psql \d output.

Currently the \d ouput from psql displays non-obvious names for 
what the RI trigger actually does.  Reading through the source code
and quering the mailing lists indicate this is easily changed (and 
I have already done this on a test database without any ill effects
so far).

Here is what the \d displays from 7.2.1:

Before:
--------------------------------------------
test=# \d foo         Table "foo"Column  |  Type   | Modifiers 
---------+---------+-----------blah_id | integer | not nullfoo     | text    | not null
Primary key: foo_pkey
Triggers: RI_ConstraintTrigger_30670

test=# \d blah         Table "blah"Column  |  Type   | Modifiers 
---------+---------+-----------blah_id | integer | not nullblah    | text    | not null
Primary key: blah_pkey
Triggers: RI_ConstraintTrigger_30672,         RI_ConstraintTrigger_30674


After:
--------------------------------------------
test=# \d foo         Table "foo"Column  |  Type   | Modifiers 
---------+---------+-----------blah_id | integer | not nullfoo     | text    | not null
Primary key: foo_pkey
Triggers: RI_blah_id (insert)

test=# \d blah        Table "blah"Column  |  Type   | Modifiers 
---------+---------+-----------blah_id | integer | not nullblah    | text    | not null
Primary key: blah_pkey
Triggers: RI_blah_id (delete),         RI_blah_id (update)


This change was made with a simple update to the pg_trigger
system table for the tgname column.

Searching through the code and the mailing list, it looks like
the only constraint to the tgname column is that it needs to be
unique (although the database schema does not inforce this via 
a unique index) since the OID tacked on to the RI_ConstraintTrigger_*
was designed to keep this uniqueness.

What I would propose is to base the RI_* off the constrain name provided
during the RI_trigger creation, if the constrain name is not provided,
then to default to the current nameing scheme.

Can anyone think of side-affects of changing the tgname column in the
pg_trigger system table?  Does this proposal seem like an acceptable
solution?  Would there be interest in this if I provided a patch to do
this?



Itch #2: Alter ownership on a sequence, etc.

Alter table provides the functionality to change the ownership of a
table, but ownership on other structures like sequences, etc can not
be changed without dropping and recreating as the new owner.  Would
there be any interest if I worked on a patch to do this too?



Thanks again for all the hard work and a great database!

- Ryan Bradetich




pgsql-hackers by date:

Previous
From: Joe Conway
Date:
Subject: Set Returning Functions (SRF) - request for patch review and comment
Next
From: "Cyril VELTER"
Date:
Subject: Re: Native Windows, Apache Portable Runtime