Re: Updated sequence syntax - Mailing list pgadmin-hackers

From Guillaume Lelarge
Subject Re: Updated sequence syntax
Date
Msg-id 1309729208.2061.5.camel@laptop
Whole thread Raw
In response to Updated sequence syntax  (Thom Brown <thom@linux.com>)
Responses Re: Updated sequence syntax  (Thom Brown <thom@linux.com>)
List pgadmin-hackers
On Sun, 2011-07-03 at 19:23 +0100, Thom Brown wrote:
> [...]
> I noticed that altering sequences still uses the old ALTER TABLE
> syntax.  While that's required for older versions, it's not anymore.
> Attached a patch to use most up-to-date syntax for each version.  This
> is based on the previous newline patch having already been applied.
>
> Obviously this won't enable anything to work that didn't previously,
> but just thought it would be nice to use more suitable syntax.
>

Sure. But there is one big misunderstanding in your patch: OWNED BY and
OWNER TO are quite different beasts. The "OWNER TO" changes the
ownership of the sequence. IOW, a user is affected as owner of the
object. "OWNED BY" creates a link between a sequence and a table's
column. This is automatically done when you use the serial datatype.
It's quite important because it tells PostgreSQL to drop the sequence
when you want to drop the table.

Anyway, the patch in itself is interesting. I wasn't willing to write
it, but as you gave it to us, I commited it with some changes :)

Thanks again.


--
Guillaume
  http://blog.guillaume.lelarge.info
  http://www.dalibo.com


pgadmin-hackers by date:

Previous
From: Guillaume Lelarge
Date:
Subject: pgAdmin III commit: Use the new syntax for sequence when possible
Next
From: Thom Brown
Date:
Subject: Re: Updated sequence syntax