From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Christopher Browne <cbbrowne(at)gmail(dot)com> |
Cc: | 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-03 14:33:55 |
Message-ID: | CAFj8pRBQ+ZJWVAd+gFrKrxY_uVhQkEF4DoEwLxu+PWj4ftM=Hg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
2012/1/3 Christopher Browne <cbbrowne(at)gmail(dot)com>:
> On Tue, Jan 3, 2012 at 5:55 AM, Samuel PHAN <samuel(at)nomao(dot)com> wrote:
>> I'm using PL/Python, and when getting the result object from a
>> plpy.execute(), I can access to the result.status().
>>
>> E.g.: the result.status() is 4. But to know what 4 corresponds to, I must
>> open the "spi.h" file from the sources to see :
>>
>> #define SPI_OK_CONNECT 1
>> #define SPI_OK_FINISH 2
>> #define SPI_OK_FETCH 3
>> #define SPI_OK_UTILITY 4
>> #define SPI_OK_SELECT 5
>> #define SPI_OK_SELINTO 6
>> #define SPI_OK_INSERT 7
>> #define SPI_OK_DELETE 8
>> #define SPI_OK_UPDATE 9
>> #define SPI_OK_CURSOR 10
>> #define SPI_OK_INSERT_RETURNING 11
>> #define SPI_OK_DELETE_RETURNING 12
>> #define SPI_OK_UPDATE_RETURNING 13
>> #define SPI_OK_REWRITTEN 14
>>
>> Is there a way to have access to these constants from the PL/python code and
>> other PL/* (Tcl, Perl, etc.) ?
>
> I'd suppose it interesting to add a table to pg_catalog containing this data.
>
> That would be one of the easier ways to allow all languages to have
> access to the constants.
- it is useless overhead
I am expecting so definition some constants in Perl, Python is simple
Regards
Pavel
>
> It might be a SMOP (Simple Matter Of Programming) to write a script to
> transform the .h file into a suitable INSERT statement for such a
> table.
>
> I wonder if there are other sets of constants worth having. I'd think
> that the various forms of "command OK" codes would also be interesting
> to have as a table like this.
> --
> When confronted by a difficult problem, solve it by reducing it to the
> question, "How would the Lone Ranger handle this?"
>
> --
> 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
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2012-01-03 15:18:22 | Re: our buffer replacement strategy is kind of lame |
Previous Message | Christopher Browne | 2012-01-03 14:23:31 | Re: Add SPI results constants available for PL/* |