Re: Remove implicit unique index creation on SERIAL columns? - Mailing list pgsql-hackers

From Joe Conway
Subject Re: Remove implicit unique index creation on SERIAL columns?
Date
Msg-id 3D5FD44B.2030702@joeconway.com
Whole thread Raw
In response to Remove implicit unique index creation on SERIAL columns?  (Rod Taylor <rbt@zort.ca>)
List pgsql-hackers
Tom Lane wrote:
> Joe Conway <mail@joeconway.com> writes:
>>In MSSQL this 
>>is gotten around by allowing the properties of the data type to be 
>>altered, e.g. in MSSQL you can turn the IDENTITY property on or off
> 
> Rather pointless if it can be turned off, wouldn't you say?

Not really. Turning it off takes an explict act of the dba (ALTER TABLE) 
for a special circumstance such as importing data. In the normal case 
while it's turned on, it is the developers who need and get the foot 
teflon (INSERT/UPDATE).


> What I would do if I wanted such a guarantee is to make insertions
> go through a view rule that prevents the serial column from being
> supplied directly.  That's a general technique that applies to more than
> just serial columns, and it is also easy to control who has privileges
> to bypass the view.

I thought about the view rule myself. Nice, but beyond the grasp of 
inexperienced users, who I think SERIAL is target for.

> AFAICT this "IDENTITY" thingie is an extremely limited kluge.

It is extremely limited -- that's why sequences are so much better 
(IMHO). But SERIAL is for those who want something simple to use, don't 
want to think about the implementation details, and don't mind it being 
limited. Otherwise why have it at all -- just make everyone use sequences.

Joe



pgsql-hackers by date:

Previous
From: Gavin Sherry
Date:
Subject: Re: [PATCHES] Better handling of parse errors
Next
From: Vince Vielhaber
Date:
Subject: Re: Open 7.3 items