Re: Returning setof records

From: "Scott Schulthess" <scott(at)topozone(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Returning setof records
Date: 2006-01-20 16:43:24
Message-ID: 4BF377919225F449BB097CB76FFE9BC83DD7F0@ptolemy.topozone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


Tom -

I've also tried this select * from placenamesearch('Cheshire',9,'New
Haven','','') as (FeatureName varchar, CountyName varchar, State char,
Cellname varchar, Elevation int4, PrimaryLatDD float8, PrimaryLonDD
float8);
ERROR: wrong record type supplied in RETURN NEXT

:( I realize it often automatically converts, and I've tried using
varchar and char for the state column, as well as int4, integer, and int
for the other columns.

-Scott

-----Original Message-----
From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
Sent: Friday, January 20, 2006 11:39 AM
To: Scott Schulthess
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: [ADMIN] Returning setof records

"Scott Schulthess" <scott(at)topozone(dot)com> writes:
> select * from placenamesearch('Cheshire',9,'New Haven','text', 'text')
> as (FeatureName varchar, CountyName varchar, State varchar,
featuretype
> varchar, Elevation int4,CellName varchar, PrimaryLatDD float8,
> PrimaryLonDD float8);
...
> state char(2),

You've got the State output column declared as varchar, but actually
it's char. PG will often do automatic conversion from one type to the
other, but in this context it's picky...

regards, tom lane

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2006-01-20 17:07:07 Re: Returning setof records
Previous Message Tom Lane 2006-01-20 16:39:12 Re: Returning setof records