Tirsdag 8. januar 2013 16.10.03 skrev Graeme Hinchliffe :
> My example code is :
> 
> CREATE TYPE testtype AS (
> a INTEGER,
> b INTEGER
> );
> 
> CREATE OR REPLACE FUNCTION test() RETURNS INTEGER AS $$
> DECLARE
>   x testtype;
> BEGIN
> (x).a:=1;
> RETURN 1;
> END
> $$ LANGUAGE plpgsql;
> 
> This throws up syntax errors for the (x).a:=1; line.. I have also tried
> SELECT INTO (x).a 1;
> 
> Any help much appreciated, version of PostgreSQL is 8.4 under Debian.

It should work with

x.a := 1;

without the parentheses. See http://solumslekt.org/blog/?p=91 for an example 
of composite types and functions.

regards, Leif


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to