Re: Error defining composite types and returning ROWTYPEs

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Geoffrey Giesemann <geoffwa(at)iinet(dot)net(dot)au>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Error defining composite types and returning ROWTYPEs
Date: 2005-06-18 13:58:38
Message-ID: 12512.1119103118@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Geoffrey Giesemann <geoffwa(at)iinet(dot)net(dot)au> writes:
> CREATE TYPE test_type as (
> some_type test_table.some_column%TYPE
> );

> Gives me:
> ERROR: syntax error at or near "%" at character 62
> LINE 2: some_type test_table.some_column%TYPE

> I also can't define rowtypes as return types on functions:
> CREATE OR REPLACE FUNCTION get_test_table_single()
> RETURNS test_table%ROWTYPE AS $$

%ROWTYPE is a plpgsql-ism, not a SQL construct. %TYPE isn't a SQL
construct either --- AFAIR we only support it in the very limited
context of CREATE FUNCTION's argument and result type declarators.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruno Wolff III 2005-06-18 14:27:32 Re: Replication
Previous Message Devrim GUNDUZ 2005-06-18 12:22:24 Re: libpq.so.3 problem, PostgreSQL >= 8.0.2 and RPM