Re: [GENERAL] Trigger problem, record "new" is not assigned yet

2011-02-10 Thread A B
I'm very embarresed now. There were another trigger that caused a problem. Now it works. Thank you all for helping! :-) 2011/2/10 Adrian Klaver : > On Thursday, February 10, 2011 6:29:58 am A B wrote: >> Hello. >> >> I'm probably doing some very basic error here, but I get >> >> ERROR:  record "

Re: [GENERAL] Trigger problem, record "new" is not assigned yet

2011-02-10 Thread Vick Khera
On Thu, Feb 10, 2011 at 9:38 AM, A B wrote: > CREATE TRIGGER trigger_foo BEFORE INSERT ON foo for each row EXECUTE > PROCEDURE trigger_foo(); > > gives me the same error. > Maybe "NEW" needs to be all caps? Also, with the BEFORE trigger, you'll need to RETURN NEW. This trigger of mine works jus

Re: [GENERAL] Trigger problem, record "new" is not assigned yet

2011-02-10 Thread Adrian Klaver
On Thursday, February 10, 2011 6:29:58 am A B wrote: > Hello. > > I'm probably doing some very basic error here, but I get > > ERROR: record "new" is not assigned yet > The tuple structure of a not-yet-assigned record is indeterminate. > > when I try this small example > > create table foo(x

Re: [GENERAL] Trigger problem, record "new" is not assigned yet

2011-02-10 Thread A B
Thanks for the suggestion, but CREATE TRIGGER trigger_foo BEFORE INSERT ON foo for each row EXECUTE PROCEDURE trigger_foo(); gives me the same error. 2011/2/10 Vick Khera : > On Thu, Feb 10, 2011 at 9:29 AM, A B wrote: >> Can someone help me spot the error? :-) >> > > use a BEFORE INSERT trigg

Re: [GENERAL] Trigger problem, record "new" is not assigned yet

2011-02-10 Thread Vick Khera
On Thu, Feb 10, 2011 at 9:29 AM, A B wrote: > Can someone help me spot the error? :-) > use a BEFORE INSERT trigger? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Trigger problem, record "new" is not assigned yet

2011-02-10 Thread A B
Hello. I'm probably doing some very basic error here, but I get ERROR: record "new" is not assigned yet The tuple structure of a not-yet-assigned record is indeterminate. when I try this small example create table foo(x int); create or replace function trigger_foo() returns trigger language

Re: [GENERAL] Trigger problem

2007-11-27 Thread Christian Rengstl
Thanks for pinpointing that out. After including your solution it shows at least something like "UPDATE OF with id: 123456567". Unfortunately after using coalesce, too, when building the field variable like: field = 'field gruppe from: ' || coalesce(OLD.gruppe, '') || ' TO ' || coalesce(NEW.gruppe

Re: [GENERAL] Trigger problem

2007-11-27 Thread A. Kretschmer
am Tue, dem 27.11.2007, um 10:38:09 +0100 mailte Christian Rengstl folgendes: > Hi list, > > act = 'DELETION of row with id: ' || OLD.id; > act = 'UPDATE OF ' || field || ' with id: ' || > ... > INSERT INTO history(aennam, action, table_name) VALUES(current_user, > act, ta

[GENERAL] Trigger problem

2007-11-27 Thread Christian Rengstl
Hi list, I have a trigger to log what the users do on the database: DECLARE _query VARCHAR; DECLARE valid BOOL; DECLARE act VARCHAR; DECLARE tab VARCHAR; DECLARE field VARCHAR; BEGIN IF(TG_OP = 'DELETE') THEN act = 'DELETION of row with id: ' || OLD.id; ELSIF(TG_OP = 'UPDATE') THEN IF N

Re: [GENERAL] Trigger problem

2005-07-22 Thread Alejandro D. Burne
Well, after hours to debug this issue, I found the problem. There is a misspelled word, thanks and sorry for waste your time. Alejandro 2005/7/21, Alejandro D. Burne <[EMAIL PROTECTED]>: > Thanks Michael for your reply, I've attached the db structure and some > data to add, this is the command th

Re: [GENERAL] Trigger problem

2005-07-20 Thread Michael Fuhr
On Wed, Jul 20, 2005 at 03:00:42PM -0300, Alejandro D. Burne wrote: > Hi, I'll be trying to write a my first trigger which fire when an user > makes an insert into a table; this insert records in others tables. > But when I try to insert a record in trigger's table generate an error: > - Syntax e

[GENERAL] Trigger problem

2005-07-20 Thread Alejandro D. Burne
Hi, I'll be trying to write a my first trigger which fire when an user makes an insert into a table; this insert records in others tables. But when I try to insert a record in trigger's table generate an error: - Syntax error near "into" in char 9. - This is the trigger. CREATE OR REPLACE FUNC

Re: [GENERAL] Trigger problem

2004-12-04 Thread Stephan Szabo
On Sat, 4 Dec 2004, Henry Molina wrote: > drop table t1; > drop table t2; > create table t1 (id integer); > create table t2 (id integer); > CREATE OR REPLACE FUNCTION myfunc() RETURNS trigger AS ' > BEGIN > insert into t2 values(NEW.id); > END; > ' LANGUAGE plpgsql; > > CREATE TRIGGER >

Re: [GENERAL] Trigger problem

2004-12-04 Thread Michael Fuhr
On Sat, Dec 04, 2004 at 11:53:46PM -0500, Henry Molina wrote: > drop table t1; > drop table t2; > create table t1 (id integer); > create table t2 (id integer); > CREATE OR REPLACE FUNCTION myfunc() RETURNS trigger AS ' > BEGIN > insert into t2 values(NEW.id); > END; > ' LANGUAGE plpgsql; >

[GENERAL] Trigger problem

2004-12-04 Thread Henry Molina
Hi all I'm having a problem with PostgreSQL 7.4.6-2 I do: drop table t1; drop table t2; create table t1 (id integer); create table t2 (id integer); CREATE OR REPLACE FUNCTION myfunc() RETURNS trigger AS ' BEGIN insert into t2 values(NEW.id); END; ' LANGUAGE plpgsql; CREATE TRIGGER

Re: [GENERAL] Trigger problem 2

2004-12-01 Thread Richard Huxton
Jamie Deppeler wrote: UPDATE wip.resource set "name" = datarecord.borname where wip.resource."primary" = OLD."primary"; get the following error Error: record "old" is not yet assigned If called from an INSERT then OLD is undefined, since there is no old version of the row. -- Richar

[GENERAL] Trigger problem 2

2004-11-30 Thread Jamie Deppeler
Hi Finally getting this trigger ro work have one last problem, im trying to use Trigger variables sample code UPDATE wip.resource set "name" = datarecord.borname where wip.resource."primary" = OLD."primary"; get the following error Error: record "old" is not yet assigned would be grea

Re: [GENERAL] Trigger problem

2000-01-19 Thread Ed Loehr
Sarah Officer wrote: > > > delete from istatus where status_code = 'A1'; > ERROR: fmgr_info: function 18848: cache lookup failed > > What is the problem with the cache lookup? Any suggestions would be > appreciated. I seem to recall that kind of message often shows up when you have dropped an

[GENERAL] Trigger problem

2000-01-19 Thread Sarah Officer
I am trying to create a simple trigger function. With some help from the mailing list, I managed to create a trigger and functions. Unfortunately I get an error message when I delete from the table which has the trigger. Can anyone help me spot the error? Here's what I have done: CREATE FUNC

[GENERAL] trigger problem?

2000-01-06 Thread Oren Teich
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, January 06, 2000 5:15 PM I'm using the fti function that is included with the source, and seem to have run into a problem with the trigger call. I have a full text index with only around 556645 entries