Re: Add SPI results constants available for PL/*

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Christopher Browne <cbbrowne(at)gmail(dot)com>, Samuel PHAN <samuel(at)nomao(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Add SPI results constants available for PL/*
Date: 2012-01-10 17:34:36
Message-ID: CAFj8pRDv4jHcP90-4KXwgYRryNToAtXbCRDZeC3GWnevr=mGqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

2012/1/10 Andrew Dunstan <andrew(at)dunslane(dot)net>:
>
>
> On 01/03/2012 09:11 PM, Andrew Dunstan wrote:
>>
>>
>>
>> On 01/03/2012 08:40 PM, Robert Haas wrote:
>>>
>>> On Tue, Jan 3, 2012 at 9:33 AM, Pavel Stehule<pavel(dot)stehule(at)gmail(dot)com>
>>>  wrote:
>>>>>
>>>>> I'd suppose it interesting to add a table to pg_catalog containing this
>>>>> data.
>>>>
>>>> - it is useless overhead
>>>
>>> I tend to agree.
>>>
>>>> I am expecting so definition some constants in Perl, Python is simple
>>>
>>> Presumably one could instead write a script to transform the list of
>>> constants into a .pm file that could be loaded into the background, or
>>> whatever PL/python's equivalent of that concept is.  Not sure if
>>> there's a better way to do it.
>>
>>
>> Yeah, I'm with you and Pavel. Here's my quick perl one-liner to produce a
>> set of SPI_* constants for pl/perl. I'm looking at the best way to include
>> this in the bootstrap code.
>>
>>   perl -ne 'BEGIN { print "use constant\n{\n"; } END { print "};\n"; }
>>   print "\t$1 => $2,\n" if /#define (SPI_\S+)\s+\(?(-?\d+)\)?/;'
>>   src/include/executor/spi.h
>>
>>
>>
>
>
> Actually, now I look closer I see that PLPerl passes back a stringified
> status from SPI_execute(), so there is no great need for setting up these
> constants. It's probably water under the bridge now, but maybe PLPython
> should have done this too.
>

This is not documented well - I see nothing about result value in doc.
Does it raise exception when SPI returns some bad result value?

Regards

Pavel

> cheers
>
> andrew

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2012-01-10 17:37:14 Re: Sending notifications from the master to the standby
Previous Message Andrew Dunstan 2012-01-10 17:29:01 Re: Add SPI results constants available for PL/*