Re: Returning setof records - Mailing list pgsql-admin

From Scott Schulthess
Subject Re: Returning setof records
Date
Msg-id 4BF377919225F449BB097CB76FFE9BC83DD7F0@ptolemy.topozone.com
Whole thread Raw
In response to Returning setof records  ("Scott Schulthess" <scott@topozone.com>)
Responses Re: Returning setof records  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@sss.pgh.pa.us]
Sent: Friday, January 20, 2006 11:39 AM
To: Scott Schulthess
Cc: pgsql-admin@postgresql.org
Subject: Re: [ADMIN] Returning setof records

"Scott Schulthess" <scott@topozone.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

pgsql-admin by date:

Previous
From: Tom Lane
Date:
Subject: Re: Returning setof records
Next
From: Tom Lane
Date:
Subject: Re: Returning setof records