GENERATED ... AS IDENTITY, Was: Re: Feature Freeze

From: Zoltan Boszormenyi <zboszor(at)dunaweb(dot)hu>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: PostgreSQL-development <pgsql-hackers(at)postgreSQL(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: GENERATED ... AS IDENTITY, Was: Re: Feature Freeze
Date: 2006-08-01 16:10:49
Message-ID: 44CF7D09.4070806@dunaweb.hu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

I have progressed a bit with my pet project, a.k.a $SUBJECT.

Now GENERATED ALWAYS AS IDENTITY and
GENERATED ALWAYS AS ( expr ) work as
intended. Documentation was also extended.
Some test cases are also included, that shows
that ALTER TABLE ALTER TYPE keeps both
the sequence and the GENERATED ALWAYS
property. Gzipped patch is attached.

Next steps are:
- pg_dump support
- more ALTER TABLE support for adding and
dropping IDENTITY and GENERATED ALWAYS
features
- more testing

I still maintain that I don't see any standard
requirement between the GENERATED AS IDENTITY
and NEXT VALUE FOR but obviously both
require SEQUENCE as supported feature
in parallel. I can be proven wrong, though,
but please, quote section# and text where
it can be found in the standard.

As for why GENERATED ALWAYS AS IDENTITY
is useful? Consider someone who is coming from
another DBMS (Informix, Access, etc.) where
"INSERT INTO table (id, ...) VALUES (0, ...);"
inserts the next value for the autoincrementer field
instead of 0. Leaving out fields from INSERT is
not allowed in the source because of documentation
reasons and writing DEFAULT is not handy or not
found in that legacy DBMS' features.
Multiply it with N applications that was written
that way over the years of the lifespan of a large
project, count in the human resistance to learn
something new (say 2.5x multiplier, but that may be
under-estimated :-) ) and a feature that help porting
easier will be a cheered feature. IIRC Bruce Momjian
himself wrote in this list that ease-of-use features
can boost PostgreSQL userbase pretty quickly.

So, please, review my patch in it's current state
and decide whether it's a 8.2-worthy feature.

BTW, is there anyone working on COPY FROM ( select ) feature?

Thanks in advance and best regards,
Zoltán Böszörményi

Attachment Content-Type Size
psql-serial-12.diff.gz application/x-tar 12.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2006-08-01 16:49:55 Re: Hash indexes
Previous Message Neil Conway 2006-08-01 16:03:21 Re: Hash indexes (was: On-disk bitmap index patch)