Re: PL/PGSQL rowtype return problem

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "rwickert(at)contextworld(dot)com" <rwickert(at)contextworld(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: PL/PGSQL rowtype return problem
Date: 2007-06-12 12:45:52
Message-ID: 162867790706120545n34dcc5beu9b00b983ede7c581@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello,

my code works well:

CREATE TABLE Foo(a integer, b integer);

CREATE OR REPLACE FUNCTION ret_foo()
RETURNS Foo AS $$
DECLARE r Foo;
BEGIN
r := (10,20); --default
RETURN r;
END; $$
LANGUAGE plpgsql;

SELECT ret_foo();

CREATE OR REPLACE FUNCTION trig()
RETURNS TRIGGER AS $$
BEGIN
NEW := ret_foo();
RETURN NEW;
END; $$
LANGUAGE plpgsql;

CREATE TRIGGER footrig BEFORE INSERT ON Foo
FOR EACH ROW EXECUTE PROCEDURE trig();

INSERT INTO Foo VALUES(0,0);

Regards
Pavel Stehule

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Michael Glaesemann 2007-06-12 13:04:22 Re: Date style handling changes between 7.4.12 and 8.2.4
Previous Message rwickert 2007-06-12 12:10:56 PL/PGSQL rowtype return problem