Re: Add SPI results constants available for PL/* - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: Add SPI results constants available for PL/*
Date
Msg-id 4F03B545.7070805@dunslane.net
Whole thread Raw
In response to Re: Add SPI results constants available for PL/*  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: Add SPI results constants available for PL/*  (Samuel PHAN <samuel@nomao.com>)
Re: Add SPI results constants available for PL/*  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Add SPI results constants available for PL/*  (Andrew Dunstan <andrew@dunslane.net>)
List pgsql-hackers

On 01/03/2012 08:40 PM, Robert Haas wrote:
> On Tue, Jan 3, 2012 at 9:33 AM, Pavel Stehule<pavel.stehule@gmail.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
 


cheers

andrew



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: controlling the location of server-side SSL files
Next
From: Robert Haas
Date:
Subject: Re: ordering op for WHERE