Error Record Is Not Assigned Yet
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you record new is not assigned yet might have Meta Discuss the workings and policies of this
Record Old Is Not Assigned Yet
site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers
The Tuple Structure Of A Not-yet-assigned Record Is Indeterminate
or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Error: Record "old" Is Not Assigned Yet
of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up PostgreSQL Trigger error up vote 13 down vote favorite 1 I have: CREATE OR REPLACE FUNCTION aktualizujIloscPodan() RETURNS TRIGGER AS $BODY$ DECLARE n integer; sid integer; BEGIN sid=0; IF (TG_OP='INSERT') THEN sid = NEW."studentID"; ELSIF postgresql after insert trigger example (TG_OP='DELETE') THEN sid = OLD."studentID"; END IF; n = COALESCE ((SELECT count("studentID") as c FROM "Podania" WHERE "studentID"=sid GROUP BY "studentID"), 0); UPDATE "Studenci" SET "licznikpodan" = n WHERE "ID"=sid; END; $BODY$ LANGUAGE plpgsql; DROP TRIGGER IF EXISTS triggenPodan ON "Podania"; CREATE TRIGGER triggenPodan AFTER INSERT OR DELETE ON "Podania" EXECUTE PROCEDURE aktualizujIloscPodan(); When I try to execute: DELETE FROM "Podania" I get ERROR: record "old" is not assigned yet DETAIL: The tuple structure of a not-yet-assigned record is indeterminate. CONTEXT: PL/pgSQL function "aktualizujiloscpodan" line 11 at assignment ********** Błąd ********** ERROR: record "old" is not assigned yet Stan SQL:55000 Szczegóły:The tuple structure of a not-yet-assigned record is indeterminate. Kontekst:PL/pgSQL function "aktualizujiloscpodan" line 11 at assignment It seems like it doesn't know what is OLD or NEW. How can I fix that? postgresql triggers share|improve this question edited Feb 1 '11 at 22:48 asked Feb 1 '11 at 21:19 Miko Kronn 1,00171943 add a comment| 2 Answers 2 a
pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php pgsql-sql pgsql-students Developer lists Regional lists Associations postgres trigger after insert User groups Project lists Inactive lists IRC Local User postgresql tg_op Groups Featured Users International Sites Propaganda Resources Weekly News PL/pgSQL: "record not assigned yet" control reached end of trigger procedure without return meaning? From: Ed Loehr
pgsql-announce pgsql-bugs pgsql-docs pgsql-general pgsql-interfaces pgsql-jobs pgsql-novice pgsql-performance pgsql-php pgsql-sql pgsql-students Developer lists Regional lists Associations User groups Project https://www.postgresql.org/message-id/AANLkTimJMN5XPU3bKK-SWy--J-3DSFTiQqSGKQQLgNJY@mail.gmail.com lists Inactive lists IRC Local User Groups Featured Users International Sites Propaganda Resources Weekly News Trigger problem, record "new" is not assigned yet From: A B