Re: BUG #2917: spi_prepare doesn't accept typename aliases

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #2917: spi_prepare doesn't accept typename aliases
Date: 2007-01-26 15:31:08
Message-ID: 24128.1169825468@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> see attached patch. If this is OK I will apply it and also fix pltcl
> and plpython similarly, mutatis mutandis.

Looks alright as far as it goes, but I'd suggest making one additional
cleanup while you're in there: get rid of the direct syscache access
altogether, instead using getTypeInputInfo(). The loop body should just
consist of three function calls: parseTypeString, getTypeInputInfo,
perm_fmgr_info.

If you wanted to be a bit more ambitious maybe you could change the fact
that this code is throwing away typmod, which means that declarations
like "varchar(32)" would fail to work as expected. Perhaps it should be
fixed to save the typmods alongside the typioparams and then pass them
to InputFunctionCall instead of passing -1. On the other hand, we don't
currently enforce typmod for any function input or result arguments, so
maybe it's consistent that spi_prepare arguments ignore typmods too.
Thoughts?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-01-26 15:38:08 Re: crash on 8.2 and cvshead - failed to add item to the
Previous Message Simon Riggs 2007-01-26 15:30:53 Re: HAVING push-down