On Tue, 6 Sep 2005, Harald Fuchs wrote: > In article <[EMAIL PROTECTED]>, > Stephan Szabo <[EMAIL PROTECTED]> writes: > > > On Fri, 2 Sep 2005, [ISO-8859-2] Graf László wrote: > > >> > >> CREATE FUNCTION test_verif() RETURNS trigger AS $test_verif$ > >> BEGIN > >> NEW.id := select nextval('test_azon_seq'); > > > I think you want to remove select here, you're already effectively doing a > > select of the right hand side in the assignment. > > >> NEW.nev := nev; > > I think you want to remove this line entirely. What nev were you > > expecting on the right hand side? If it's the new one, well, NEW.new is > > already that. > > László could also remove the entire trigger and use something like > > > CREATE TABLE test ( > id SERIAL NOT NULL, > nev VARCHAR(25), > datum TIMESTAMP NOT NULL DEFAULT current_timestamp, > PRIMARY KEY (id) > );
That's slightly different though. The trigger forces the value whether or not a value was assigned in the insert, the defaults only apply if the column does not have a value given to it. ---------------------------(end of broadcast)--------------------------- TIP 6: explain analyze is your friend