Re: Status of plperl inter-sp calling

From: Garick Hamlin <ghamlin(at)isc(dot)upenn(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, Tim Bunce <Tim(dot)Bunce(at)pobox(dot)com>, "David E(dot) Wheeler" <david(at)kineticode(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Status of plperl inter-sp calling
Date: 2010-01-06 18:29:25
Message-ID: 20100106182925.GA99135@isc.upenn.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jan 06, 2010 at 11:14:38AM -0500, Tom Lane wrote:
> Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> > Tom Lane wrote:
> >> spi_rv = SPI_execute(query, current_call_data->prodesc->fn_readonly,
> >> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> > OK, but won't that automatically supply the value from the function
> > called from postgres, which will be the right thing?
>
> My point was that that is exactly the wrong thing. If I have a function
> declared stable, it must not suddenly start behaving as volatile because
> it was called from a volatile function. Nor vice versa.
>
> Now as I mentioned upthread, there might be other ways to get the
> correct value of the readonly parameter. One that comes to mind is
> to somehow attach it to the spi call "at compile time", whatever that
> means in the perl world. But you can't just have it be determined by
> the outermost active function call.

If you want 'a perl compile time hook', those are called attributes.
http://search.cpan.org/~dapm/perl-5.10.1/lib/attributes.pm

You can define attributes to effect how a given syntax compiles.
perl.

my $var :foo;

or

sub bar :foo;

The subroutine or variable is compiled in a way defined by the
':foo' attribute.

This might be a clean way around the type dispatch issues
as well. One could include the invokant type information in the
perl declaration.

sub sp_something :pg_sp ('bigint bigint');

sp_something ("12",0);

Anyway, that looks like a nice interface to me...

Although, I don't understand the Pg internals problem faced here
so ... I'm not sure my suggestion is helpful.

Garick
>
> regards, tom lane
>
> --
> Sent via pgsql-hackers mailing list (pgsql-hackers(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-hackers

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message A. Kretschmer 2010-01-06 18:30:56 Re: [pgsql-www] tribble.postgresql.org - planned maintenance downtime
Previous Message Leonardo F 2010-01-06 18:21:03 Re: I: TODO: Allow substring/replace() to get/set bit values