| From: | A B <gentosaker(at)gmail(dot)com> |
|---|---|
| To: | adrian(dot)klaver(at)gmail(dot)com |
| Cc: | pgsql-general(at)postgresql(dot)org |
| Subject: | Re: Trigger problem, record "new" is not assigned yet |
| Date: | 2011-02-10 15:15:07 |
| Message-ID: | AANLkTikrmoAxAKvCAuVAFAUWnCxJsAQOpvtiMh5vD1oL@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
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 <adrian(dot)klaver(at)gmail(dot)com>:
> 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 int);
>>
>> create or replace function trigger_foo() returns trigger language plpgsql
>> as $$ declare v_i integer;
>> begin
>> select count(1) into v_i from foo;
>> if new.x >18 then
>> raise exception 'error';
>> else
>> return null;
>> end if;
>> end; $$;
>>
>> CREATE TRIGGER trigger_foo AFTER INSERT ON foo for each row EXECUTE
>> PROCEDURE trigger_foo();
>>
>> insert into foo (x) values (15);
>>
>>
>> And the table foo only have 14 lines right now.
>>
>> Can someone help me spot the error? :-)
>
> The above works here, Postgres 9.0.3. Was that the complete error message? Is
> there more than one foo across the schemas?
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)gmail(dot)com
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jens Sauer | 2011-02-10 16:16:33 | Re: fulltext search and hunspell |
| Previous Message | Vick Khera | 2011-02-10 15:03:03 | Re: Trigger problem, record "new" is not assigned yet |