pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Dani Oderbolz <oderbolz@ecologic.de>
To: Randall Lucas <rlucas@tercent.net>
Cc: pgsql-sql@postgresql.org
Subject: Re: Change the behaviour of the SERIAL "Type"
Date: Fri, 27 Jun 2003 10:45:07 +0200
Message-ID: <3EFC0413.7090006@ecologic.de> (raw)
In-Reply-To: <FA785BC0-A7EF-11D7-8248-000A957653D6@tercent.net>
References: <FA785BC0-A7EF-11D7-8248-000A957653D6@tercent.net>

Randall Lucas wrote:

>
> Wow, I had never actually faced this problem (yet) but I spied it as a 
> possible stumbling block for porting MySQL apps, for which the 
> standard practice is inserting a NULL.  As I have made a fairly 
> thorough reading of the docs (but may have not cross-correlated every 
> piece of data yet, obviously), I was surprised to find I hadn't 
> figured this out myself.  It /seems/ obvious in retrospect, but it 
> really baked my noodle when I first looked at some ugly MySQL queries.
>
> Respectfully, then, I move that a sentence outlining this 
> functionality be added to User Manual section 5.1.4, "The Serial 
> Types."  Furthermore, anyone who has written or is writing a MySQL 
> porting guide should include this, if he hasn't. 

Yea, fine, but I propose a different (deeper) approach.
Why does SERIAL only enforce a DEFAULT?
This is not an exact imitation of an autoincrement, as a DEFAULT can be 
overwritten.
In my oppinion, SERIAL should implicitly create a Trigger on the table, 
which then
handles this transparently.
Would that be difficult?
(I am already writing a Procedure which gets all the info needed out of 
the Catalog,
but my problem is that I need some dynamic statements in there...)

Cheers, Dani





view thread (8+ messages)  latest in thread

Message-ID: <3EFC0413.7090006@ecologic.de>
Permalink:  ../3EFC0413.7090006@ecologic.de/
Also on:    postgresql.org/message-id/3EFC0413.7090006@ecologic.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: oderbolz@ecologic.de, rlucas@tercent.net
  Subject: Re: Change the behaviour of the SERIAL "Type"
  In-Reply-To: <3EFC0413.7090006@ecologic.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox