From: | Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | Catalin Iacob <iacobcatalin(at)gmail(dot)com> |
Cc: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Bruce Momjian <bruce(at)momjian(dot)us>, Robert Haas <robertmhaas(at)gmail(dot)com>, Jim Nasby <Jim(dot)Nasby(at)bluetreble(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-17 14:32:22 |
Message-ID: | CAFj8pRBCz14q_rY+d9dDzTwgpc1BTWoSstjkKcMnQFv8D8vbMw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi
2016-02-17 7:34 GMT+01:00 Catalin Iacob <iacobcatalin(at)gmail(dot)com>:
> After I unzip the patch it doesn't apply.
> patch says:
> patch: **** Only garbage was found in the patch input.
>
> It's a combined diff, the git-diff manual says this about it:
> Chunk header format is modified to prevent people from accidentally
> feeding it to patch -p1. Combined diff format was created for review
> of merge commit changes, and was not meant for apply.
>
> Thanks for doing the test changes. It definitely shows the change is
> big. The tests at least were heavily relying on both the str
> conversion and on passing more than one argument. Sad face.
> You're going to hate me but seeing this I changed my mind about 5,
> requiring all those extra str calls is too much change in behaviour. I
> was going to propose passing everything through str (so message,
> detail, hint but also schema, table) but thinking about it some more,
> I think I have something better.
>
Ok, it is no problem - this work is +/- research, and there are not direct
way often :)
>
> Python 3 has keyword only arguments. It occurs to me they're exactly
> for "optional extra stuff" like detail, hint etc.
> Python 2 doesn't have that notion but you can kind of fake it since
> you get an args tuple and a kwargs dictionary.
>
I prefer a possibility to use both ways - positional form is shorter,
keywords can help with some parameters.
But I cannot to imagine your idea, can you show it in detail?
>
> What about keeping the same behaviour for multiple positional
> arguments (single one -> make it str, multiple -> use str of the args
> tuple) and requiring users to pass detail, hint only as keyword
> arguments? Code wise it would only mean adding PyObject* kw to
> PLy_output and adding some code to extract detail, hint etc. from kw.
> This would also allow getting rid of the GUC since backward
> compatibility is fully preserved.
>
> Again, sorry for all the back and forth but it still feels like we
> haven't nailed the design to something satisfactory. All the tests you
> needed to change are a hint towards that.
>
It not any problem. I am thankful for cooperation.
Regards
Pavel
Attachment | Content-Type | Size |
---|---|---|
plpython-enhanced-error-03.patch | text/x-patch | 57.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Artur Zakirov | 2016-02-17 14:37:58 | Re: Fuzzy substring searching with the pg_trgm extension |
Previous Message | Tom Lane | 2016-02-17 14:25:48 | Re: Re: [COMMITTERS] pgsql: Introduce group locking to prevent parallel processes from deadl |