From: "David E. Wheeler" on
On Feb 16, 2010, at 2:06 PM, Tim Bunce wrote:

>> I assume that type names can be omitted her, too, yes?
>
> No, it seems not. You have to either repeat the type name the right number
> of times, or use '...', which simply duplicates the type name for you
> behind the scenes. I'll clarify that in the docs (and fix all the
> places I spelt variadic wrong :)

Pity.

> SP->"schema.func"() doesn't work. ($name="schema.func"; SP->$name() works.)

Ha! Document that.

>>> For varadic functions, separate plans are created and cached for each distinct
>>> number of arguments the function is called with.
>>
>> Why?
>
> It keeps the code simple and repeat calls fast.

Yes, but if it's a variadic function, I suspect that it won't often be called with the same number of args. So you'd potentially end up caching a lot of extra stuff that would never be used again.

> I found it in the docs: "A parameter marked VARIADIC matches *one* or
> more occurrences of its element type".
> http://www.postgresql.org/docs/8.4/interactive/xfunc-sql.html

Ah, okay, that makes sense.

>> So, is this on GitHub yet? That way I can submit patches.
>
> I've uploaded PostgreSQL-PLPerl-Call-1.003.tar.gz to CPAN with these
> changes. It's in git but not github yet. Maybe soonish.

I saw. I think it might pay to heed Richard's suggestion not to use "SP".

By the way, I think it needs some documentation explaining how to load it inside PL/Perl.

Best,

David



--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: "David E. Wheeler" on
On Feb 16, 2010, at 3:01 PM, Tom Lane wrote:

> I think the reason the client-side docs recommend using zero is to avoid
> having clients know about the unknown type explicitly (in particular, to
> discourage people from hardwiring "705" into their code). AFAIR there's
> not a lot of difference in terms of what the parser will do with it.

We should probably get rid of this in DBD::Pg then:

% perl -MDBD::Pg -E 'say DBD::Pg::PG_UNKNOWN'
705

Best,

David

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Tom Lane on
Martijn van Oosterhout <kleptog(a)svana.org> writes:
> On Tue, Feb 16, 2010 at 09:11:24AM -0800, David E. Wheeler wrote:
>>> An extra source of puzzlement is that the oid of the 'unknown' type is
>>> 705 not 0, and the unknown type isn't discussed in the docs (as far as I
>>> could see).
>>
>> Yes, I noticed that, too. Greg, do you know the answer to that?

> My guess is that, semantically, 0 means the datatype is unknown,
> whereas 705 means the datatype is known to be type "unknown".

I think the reason the client-side docs recommend using zero is to avoid
having clients know about the unknown type explicitly (in particular, to
discourage people from hardwiring "705" into their code). AFAIR there's
not a lot of difference in terms of what the parser will do with it.

regards, tom lane

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: "David E. Wheeler" on
On Feb 17, 2010, at 4:28 AM, Tim Bunce wrote:

>> Yes, but if it's a variadic function, I suspect that it won't often be
>> called with the same number of args. So you'd potentially end up
>> caching a lot of extra stuff that would never be used again.
>
> Potentially. Patches welcome!

GitHub. ;-P

> Umm, perhaps F->funcname(@args), or PG->funcname(@args), or ... ?
>
> Anyone got any better suggestions?

PG is good. Or maybe DB?

>> By the way, I think it needs some documentation explaining how to load it inside PL/Perl.
>
> I thought about that, and started to write it, but dropped it for now.
> I'll wait till my "cunning plan" to share code with the Safe compartment
> (aka PostgreSQL::PLPerl::Injector) is done then document how call() can
> be used in both plperlu and plperl.

Ah, okay.

Best,

David



--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

From: Dimitri Fontaine on
Tim Bunce <Tim.Bunce(a)pobox.com> writes:
>> I like "F->funcname" or "FN->funcname" myself.
>
> Thanks. I quite like FN.
>
> Anybody else want to express an opinion on the color if this bikeshed
> before I repaint it?

I wouldn't have, but since you ask... What about reusing the internal
name, you seem to be emulating the fmgr in plperl. My proposal is thus
FMGR.

Regards,
--
dim

--
Sent via pgsql-hackers mailing list (pgsql-hackers(a)postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers