Re: Function Returning SETOF RECORD: Trouble With Char Type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Angus B(dot) Atkins-Trimnell" <trimnell(at)uic(dot)edu>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Function Returning SETOF RECORD: Trouble With Char Type
Date: 2008-03-12 19:32:56
Message-ID: 28960.1205350376@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Angus B. Atkins-Trimnell" <trimnell(at)uic(dot)edu> writes:
> I am having trouble with a function designed to return all column
> constraints on a table.

I think the problem is that you're declaring the contype return column
as char (ie, character(1)) when pg_constraint.contype is actually "char"
(a historical PG datatype that's really just a single byte). The naming
confusion is unfortunate but we've never bitten the bullet to rename
"char" to something else.

Use quotes, or explicitly cast the catalog column to regular char
in the function's query.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Greg Sabino Mullane 2008-03-12 19:34:03 Re: pain of postgres upgrade with extensions
Previous Message sam 2008-03-12 19:31:21 Re: Trouble with Savepoints in postgres