From: | Jim Nasby <Jim(dot)Nasby(at)BlueTreble(dot)com> |
---|---|
To: | Catalin Iacob <iacobcatalin(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>, Peter Eisentraut <peter_e(at)gmx(dot)net>, Craig Ringer <craig(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: proposal: PL/Pythonu - function ereport |
Date: | 2016-02-05 00:04:49 |
Message-ID: | 56B3E721.2090804@BlueTreble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2/4/16 3:13 AM, Catalin Iacob wrote:
Thanks for the overview. Very helpful.
> I find existing behaviour for 2, 3 and 4 unlike other Python APIs I've
> seen, surprising and not very useful. If I want to log a tuple I can
> construct and pass a single tuple, I don't see why plpy.info() needs
> to construct it for me. And for the documented, single argument call
> nothing changes.
Agreed, that usage is wonky.
> The question to Bruce (and others) is: is it ok to change to the new
> behaviour illustrated and change meaning for usages like 2, 3 and 4?
If any users have a bunch of code that depends on the old behavior,
they're going to be rather irritated if we break it. If we want to
depricate it then I think we need a GUC that allows you to get the old
behavior back.
> If we don't want that, the solution Pavel and I see is introducing a
> parallel API named plpy.raise_info or plpy.rich_info or something like
> that with the new behaviour and leave the existing functions
> unchanged. Another option is some compatibility GUC but I don't think
> it's worth the trouble and confusion.
If we're going to provide an alternative API, I'd just do
plpy.raise(LEVEL, ...).
At this point, my vote would be:
Add a plpython.ereport_mode GUC that has 3 settings: current
(deprecated) behavior, allow ONLY 1 argument, new behavior. The reason
for the 1 argument option is it makes it much easier to find code that's
still using the old behavior. I think it's also worth having
plpy.raise(LEVEL, ...) as an alternative.
If folks feel that's overkill then I'd vote to leave the existing
behavior alone and just add plpy.raise(LEVEL, ...).
--
Jim Nasby, Data Architect, Blue Treble Consulting, Austin TX
Experts in Analytics, Data Architecture and PostgreSQL
Data in Trouble? Get it in Treble! http://BlueTreble.com
From | Date | Subject | |
---|---|---|---|
Next Message | Jim Nasby | 2016-02-05 00:16:30 | Re: Way to check whether a particular block is on the shared_buffer? |
Previous Message | Jim Nasby | 2016-02-04 23:52:20 | Re: "using previous checkpoint record at" maybe not the greatest idea? |