On 3 July 2011 22:40, Guillaume Lelarge <guillaume@lelarge.info> wrote:
> 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 :)
The moment you mentioned there being a distinction between OWNED BY
and OWNER to, I immediately knew what you meant. Thanks. :)
--
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company