Re: [HACKERS] AUTO_INCREMENT patch

2003-08-02 Thread Andrew Dunstan
Rod Taylor wrote about using views for identity cols, thus: t=# create schema jboss t-# create view test as select * from data.test; CREATE SCHEMA t=# t=# create rule test_id_generate as on insert to jboss.test t-# do instead t-# insert into data.test (id, word) values (default, new.word);

Re: [HACKERS] AUTO_INCREMENT patch

2003-08-02 Thread Andrew Dunstan
OK, I read further and now understand. Sorry. andrew - Original Message - From: "Andrew Dunstan" <[EMAIL PROTECTED]> To: "PostgreSQL Development" <[EMAIL PROTECTED]> Sent: Saturday, August 02, 2003 10:09 PM Subject: Re: [HACKERS] AUTO_INCREMENT patch

Re: [HACKERS] AUTO_INCREMENT patch

2003-08-02 Thread Rod Taylor
> des=# create table test ( id serial, word text ); > NOTICE: CREATE TABLE will create implicit sequence "test_id_seq" for SERIAL column > "test.id" > CREATE TABLE > des=# create rule test_id_generate as > des-# on insert to test do instead > des-# insert into test ( id, word ) values ( default,

Re: [HACKERS] AUTO_INCREMENT patch

2003-08-02 Thread Dag-Erling Smørgrav
Rod Taylor <[EMAIL PROTECTED]> writes: > CREATE OR REPLACE RULE rulename AS ON INSERT > TO tablename > DO INSTEAD >INSERT INTO tablename > ( id, col1, ...) > VALUES ( DEFAULT, NEW.col1, ...); > I now have a patch that adds support for the GENERATED ... AS ... syntax and

Re: [HACKERS] AUTO_INCREMENT patch

2003-08-02 Thread Dag-Erling Smørgrav
Rod Taylor <[EMAIL PROTECTED]> writes: > Yeah.. JBoss is very annoying in this regard. A temporary solution seems > to be to use BEFORE triggers to force the sequence to be used for the > default value. You could also do this with an INSTEAD rule (something > like the below): > > CREATE OR REPLACE

Re: [HACKERS] AUTO_INCREMENT patch

2003-08-02 Thread Rod Taylor
Moving to -hackers > I'm working on getting auto-incrementing CMP fields in JBoss 3.2.1 to > work with PostgreSQL data sources. There are currently two obstacles > to this. Yeah.. JBoss is very annoying in this regard. A temporary solution seems to be to use BEFORE triggers to force the sequence