Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG) - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG)
Date
Msg-id 15735.1271283154@sss.pgh.pa.us
Whole thread Raw
In response to Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG)  (Pavel Stehule <pavel.stehule@gmail.com>)
Responses Re: Bug in CREATE FUNCTION with character type (CONFIRMED BUG)
List pgsql-bugs
Pavel Stehule <pavel.stehule@gmail.com> writes:
> RETURNS TABLE (x int, y int) is equal to CREATE FUNCTION foo(.. OUT x
> int, OUT y int) RETURNS SETOF RECORD. But PostgreSQL functions ignore
> typmod for parameters - so it is not bug, it is feature :(

Yeah.  Or at least, this is not something that can be changed without a
great deal of work --- and application breakage, more than likely.

You could possibly get the length to be enforced by storing into a local
variable of the record type before returning it.  I think plpgsql does
account for typmod when assigning to locals.

            regards, tom lane

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Bug in CREATE FUNCTION with character type
Next
From: Tom Lane
Date:
Subject: Re: BUG #5416: int4inc() is wrong