Re: [HACKERS] plpgsql.warn_shadow

2014-02-02 Thread Marko Tiikkaja
overkill, though. I tried to keep things simple. Regards, Marko Tiikkaja *** a/doc/src/sgml/plpgsql.sgml --- b/doc/src/sgml/plpgsql.sgml *** *** 4712,4717 a_output := a_output || $$ if v_$$ || referrer_keys.kind || $$ like '$$ --- 4712,4762 /variablelist /sect2

Re: [HACKERS] 94 ignores missing selectlist

2014-01-30 Thread Marko Tiikkaja
On 1/30/14, 10:44 AM, Erik Rijkers wrote: This seems wrong: in HEAD, an empty select list does *not* generate a error warning anymore: This is intentional, see 1b4f7f93b4693858cb983af3cd557f6097dab67b Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers

Re: [HACKERS] new json funcs

2014-01-28 Thread Marko Tiikkaja
. - There are a few cases of curly braces around a single-statement else, which I believe is against the project's code style guidelines. Otherwise this patch looks good to my eyes. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: Fwd: [HACKERS] patch: make_timestamp function

2014-01-25 Thread Marko Tiikkaja
Looks good to me. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] array_length(anyarray)

2014-01-21 Thread Marko Tiikkaja
that people weren't sure about, and people seemed to think it should behave like this one does. So I've gone ahead and committed this, crossing my fingers that we won't have to rip it back out again. Thanks! I'll keep my fingers crossed as well. Regards, Marko Tiikkaja -- Sent via pgsql-hackers

Re: [HACKERS] new json funcs

2014-01-21 Thread Marko Tiikkaja
being. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] plpgsql.warn_shadow

2014-01-20 Thread Marko Tiikkaja
On 1/20/14 2:25 AM, Robert Haas wrote: On Fri, Jan 17, 2014 at 5:45 AM, Marko Tiikkaja ma...@joh.to wrote: I see these as being two are different things. There *is* a need for a full-blown static analyzer for PL/PgSQL, but I don't think it needs to be in core. However, there seems

Re: [HACKERS] plpgsql.warn_shadow

2014-01-20 Thread Marko Tiikkaja
On 1/20/14 1:55 PM, Robert Haas wrote: On Mon, Jan 20, 2014 at 7:16 AM, Marko Tiikkaja ma...@joh.to wrote: What's so hard about plpgsql.warnings='all'? Or if the fact that it's a list is your concern, I'm not going to oppose to making it a boolean. Sure, that'd be fine. What I don't want

Re: [HACKERS] array_length(anyarray)

2014-01-20 Thread Marko Tiikkaja
that? I'm not planning on fixing the inconsistencies, though, despite them annoying me. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] array_length(anyarray)

2014-01-19 Thread Marko Tiikkaja
On 1/19/14, 9:12 AM, Dean Rasheed wrote: On 18 January 2014 03:07, Marko Tiikkaja ma...@joh.to wrote: Here's the patch as promised. Thoughts? A couple of points: The answer for empty (zero dimensional) arrays is wrong --- you need special case handling for this case to return 0. How

Re: [HACKERS] array_length(anyarray)

2014-01-19 Thread Marko Tiikkaja
this fixed for all functions, not just array functions. But I think that should be a separate patch. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] new json funcs

2014-01-18 Thread Marko Tiikkaja
a pgindent run, I presume)? I just read through three pagefuls and I didn't see any relevant changes, but I'm not sure I want to keep doing that for the rest of the patch. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] new json funcs

2014-01-18 Thread Marko Tiikkaja
On 1/18/14, 9:38 PM, Andrew Dunstan wrote: On 01/18/2014 12:34 PM, Marko Tiikkaja wrote: Is it possible for you to generate a diff that doesn't have all these unrelated changes in it (from a pgindent run, I presume)? I just read through three pagefuls and I didn't see any relevant changes

Re: [HACKERS] array_length(anyarray)

2014-01-18 Thread Marko Tiikkaja
disk, the file my email clients claims to have sent or a copy of the file I downloaded from the archives. Are you sure this isn't a problem on your end? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] plpgsql.warn_shadow

2014-01-17 Thread Marko Tiikkaja
. However, there seems to be a number of pitfalls we could warn the user about with little effort in core, and I think those are worth doing. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] array_length(anyarray)

2014-01-17 Thread Marko Tiikkaja
along these lines. Here's the patch as promised. Thoughts? Regards, Marko Tiikkaja *** a/doc/src/sgml/array.sgml --- b/doc/src/sgml/array.sgml *** *** 338,343 SELECT array_length(schedule, 1) FROM sal_emp WHERE name = 'Carol'; --- 338,356 2 (1 row

Re: [HACKERS] Display oprcode and its volatility in \do+

2014-01-16 Thread Marko Tiikkaja
. Even I personally felt the Function and Volatility is nice to have info into \do+. Marking it as ready for committer. Thanks for reviewing! Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] Display oprcode and its volatility in \do+

2014-01-16 Thread Marko Tiikkaja
On 1/16/14 4:22 PM, Tom Lane wrote: Marko Tiikkaja ma...@joh.to writes: On 1/16/14 9:53 AM, Rushabh Lathia wrote: Even I personally felt the Function and Volatility is nice to have info into \do+. FWIW, I'm on board with the idea of printing the oprcode, but adding volatility here seems like

Re: [HACKERS] Display oprcode and its volatility in \do+

2014-01-16 Thread Marko Tiikkaja
as well, sorry about that. :-( Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] proposal, patch: allow multiple plpgsql plugins

2014-01-16 Thread Marko Tiikkaja
. That should probably be added? I'm not sure when _PG_fini() would be called. 4) The comment /* reserved for use by optional plugin */ seems a bit weird in its new context. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
On 1/15/14 7:07 AM, Florian Pflug wrote: On Jan15, 2014, at 01:34 , Marko Tiikkaja ma...@joh.to wrote: It's me again, trying to find a solution to the most common mistakes I make. This time it's accidental shadowing of variables, especially input variables. I've wasted several hours banging

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
On 1/15/14 11:20 AM, Pavel Stehule wrote: 2014/1/15 Marko Tiikkaja ma...@joh.to Hmm. How about: plpgsql.warnings = 'all' # enable all warnings, defauls to the empty list, i.e. no warnings plpgsql.warnings = 'shadow, unused' # enable just shadow and unused warnings

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
On 1/15/14 11:33 AM, Pavel Stehule wrote: 2014/1/15 Marko Tiikkaja ma...@joh.to I agree, it's better to include the word compiler in the GUC name. But do we really need WARNING, ERROR and FATAL levels though? Would WARNING and ERROR not be enough? I am not strong in level names

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
accurately). I like the idea of warning about SELECT .. INTO, though, but that one could have a non-negligible performance penalty during execution. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
On 1/15/14 2:00 PM, Florian Pflug wrote: On Jan15, 2014, at 13:32 , Marko Tiikkaja ma...@joh.to wrote: On 1/15/14 1:23 PM, Florian Pflug wrote: The fact that it's named plpgsql.warnings already clearly documents that this only affects plpgsql. But whether a particular warning is emitted

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
On 1/15/14 2:27 PM, Pavel Stehule wrote: 2014/1/15 Marko Tiikkaja ma...@joh.to Yeah, me neither, it's just something that needs to be communicated very clearly. So probably just a list plpgsql.warnings would be the most appropriate then. I am thinking so the name is not good. Changing

Re: [HACKERS] plpgsql.warn_shadow

2014-01-15 Thread Marko Tiikkaja
. Every option shoudl to do one clean thing. It looks to me like the GUC *is* doing only one thing. list of warnings I want to see, or the shorthand all for convenience. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] plpgsql.consistent_into

2014-01-14 Thread Marko Tiikkaja
additional plpgsql extensions). While this sounds cool, running a modified postgres locally seems a lot easier. I already have to do that for PL/PgSQL development because of the reasons I outlined in the thread PL/PgSQL, RAISE and error context. Regards, Marko Tiikkaja -- Sent via pgsql-hackers

Re: [HACKERS] plpgsql.consistent_into

2014-01-14 Thread Marko Tiikkaja
INTO, then that solves multiple problems in the language without breaking backwards compatibility. I don't personally have a problem with INTO other than the behaviour that started this thread. But I'm willing to consider other options. On Tue, Jan 14, 2014 at 4:30 AM, Marko Tiikkaja ma

Re: [HACKERS] plpgsql.consistent_into

2014-01-14 Thread Marko Tiikkaja
Are you saying that DB2 supports the multi-variable assignment? I couldn't find any reference suggesting that, can you point me to one? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [HACKERS] plpgsql.consistent_into

2014-01-14 Thread Marko Tiikkaja
On 1/14/14, 6:15 PM, Tom Lane wrote: Marko Tiikkaja ma...@joh.to writes: How about: (a) = SELECT 1; (a, b) = SELECT 1, 2; (a, b) = INSERT INTO foo RETURNING col1, col2; Same semantics: TOO_MANY_ROWS on rows 1, sets FOUND and row_count. AFAICT this can be parsed unambiguously

[HACKERS] plpgsql.warn_shadow

2014-01-14 Thread Marko Tiikkaja
change behaviour, just emits some warnings when a potentially faulty function is compiled. Let me know what you think so I can either cry or clean the patch up. Regards, Marko Tiikkaja *** a/src/pl/plpgsql/src/pl_comp.c --- b/src/pl/plpgsql/src/pl_comp.c *** *** 352,357 do_compile

Re: [HACKERS] plpgsql.consistent_into

2014-01-13 Thread Marko Tiikkaja
, we are going to have to do changes like this to make the language better. Also I think that out of all the things we could do to break backwards compatibility, this is closer to harmless than a pain in the butt. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers

Re: [HACKERS] plpgsql.consistent_into

2014-01-13 Thread Marko Tiikkaja
think I've ever publicly said that it should. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] plpgsql.consistent_into

2014-01-13 Thread Marko Tiikkaja
On 2014-01-14 02:54, Marti Raudsepp wrote: On Sun, Jan 12, 2014 at 7:51 AM, Marko Tiikkaja ma...@joh.to wrote: the behaviour of SELECT .. INTO when the query returns more than one row. Some of you might know that no exception is raised in this case Agreed. But I also agree with the rest

Re: [HACKERS] plpgsql.consistent_into

2014-01-12 Thread Marko Tiikkaja
On 1/12/14, 7:47 AM, Pavel Stehule wrote: 2014/1/12 Marko Tiikkaja ma...@joh.to Greetings fellow elephants, I would humbly like to submit for your consideration my proposal for alleviating pain caused by one of the most annoying footguns in PL/PgSQL: the behaviour of SELECT .. INTO when

Re: [HACKERS] proposal, patch: allow multiple plpgsql plugins

2014-01-12 Thread Marko Tiikkaja
the API, can't we pass it directly to the callback function? Am I missing something completely obvious? :-) Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] proposal, patch: allow multiple plpgsql plugins

2014-01-12 Thread Marko Tiikkaja
state? If we're going to change the API, can't we pass it directly to the callback function? Oh, I think I'm being stupid -- we'd only have to do what *if* we don't want to change the API? Then my vote is for breaking the API. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list

Re: [HACKERS] plpgsql.consistent_into

2014-01-12 Thread Marko Tiikkaja
On 1/12/14, 10:19 PM, Florian Pflug wrote: On Jan12, 2014, at 06:51 , Marko Tiikkaja ma...@joh.to wrote: set plpgsql.consistent_into to true; I don't think a GUC is the best way to handle this. Handling this via a per-function setting similar to #variable_conflict would IMHO be better

Re: [HACKERS] array_length(anyarray)

2014-01-11 Thread Marko Tiikkaja
reasonable option. I'll send an updated patch along these lines. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] plpgsql.consistent_into

2014-01-11 Thread Marko Tiikkaja
as well. The patch, as currently written, also changes the behaviour of EXECUTE .. INTO, but I don't feel strongly about whether that should be affected as well or not. Regards, Marko Tiikkaja *** a/doc/src/sgml/plpgsql.sgml --- b/doc/src/sgml/plpgsql.sgml *** *** 1043,1050

Re: [HACKERS] array_length(anyarray)

2014-01-10 Thread Marko Tiikkaja
On 1/10/14, 9:04 AM, Dean Rasheed wrote: On 10 January 2014 00:36, Marko Tiikkaja ma...@joh.to wrote: Can you point me to some examples? The example I see all the time is code like if array_length(nodes, 1) 5 then ... do something ... then you realise (or not as the case may

Re: [HACKERS] array_length(anyarray)

2014-01-10 Thread Marko Tiikkaja
}}'::int[]) would return VALUES (1, '{1,2}'::int[]), (2, '{3,4}'::int[])? If so, then yes, that's a functionality I've considered us to have been missing for a long time. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] array_length(anyarray)

2014-01-09 Thread Marko Tiikkaja
with unnest() without actually having to look at the length. Same goes for multi-dimensional arrays: you have even less things you can do there with only a length. So if we give up these constraints, we also make this function completely useless. Regards, Marko Tiikkaja -- Sent via pgsql-hackers

Re: [HACKERS] array_length(anyarray)

2014-01-09 Thread Marko Tiikkaja
reasonable behaviors as possible. That's exactly what I've done here. :-) Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] array_length(anyarray)

2013-12-18 Thread Marko Tiikkaja
this to the next commit fest, but feel free to discuss it before that. Regards, Marko Tiikkaja *** a/doc/src/sgml/array.sgml --- b/doc/src/sgml/array.sgml *** *** 338,343 SELECT array_length(schedule, 1) FROM sal_emp WHERE name = 'Carol'; --- 338,354 2 (1

Re: [HACKERS] array_length(anyarray)

2013-12-18 Thread Marko Tiikkaja
On 2013-12-18 22:13, Andrew Dunstan wrote: On 12/18/2013 03:27 PM, Marko Tiikkaja wrote: Attached is a patch to add support for array_length(anyarray), which only works for one-dimensional arrays, returns 0 for empty arrays and complains if the array's lower bound isn't 1. In other words, does

Re: [HACKERS] array_length(anyarray)

2013-12-18 Thread Marko Tiikkaja
On 2013-12-18 22:19, I wrote: On 2013-12-18 22:13, Andrew Dunstan wrote: On 12/18/2013 03:27 PM, Marko Tiikkaja wrote: Attached is a patch to add support for array_length(anyarray), which only works for one-dimensional arrays, returns 0 for empty arrays and complains if the array's lower bound

Re: [HACKERS] array_length(anyarray)

2013-12-18 Thread Marko Tiikkaja
, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] array_length(anyarray)

2013-12-18 Thread Marko Tiikkaja
On 12/19/13, 12:01 AM, David Johnston wrote: Marko Tiikkaja-4 wrote On 2013-12-18 22:32, Andrew Dunstan wrote: You're not really free to assume it - you'll need an exception handler for the other-than-1 case, or your code might blow up. This seems to be codifying a bad pattern, which should

Re: [HACKERS] Why no INSTEAD OF triggers on tables?

2013-12-17 Thread Marko Tiikkaja
) returning *; a --- 1 (1 row) INSERT 0 1 local:marko=#* insert into bart values (1) returning *; a --- (0 rows) INSERT 0 0 Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [HACKERS] psql shows line number

2013-11-26 Thread Marko Tiikkaja
. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] psql shows line number

2013-11-26 Thread Marko Tiikkaja
On 11/26/13 2:24 PM, Pavel Stehule wrote: yes, but we can define new statement like \sq+ (Show Query) There's already \p; might not be too difficult to add a \p+ which would also show the line numbers. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers

Re: [HACKERS] tcp_keepalives_idle

2013-11-14 Thread Marko Tiikkaja
.. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] [PATCH] pg_basebackup: progress report max once per second

2013-11-14 Thread Marko Tiikkaja
hunk in progress_report does not conform to the code style guidelines of the project. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Description on bind message

2013-10-15 Thread Marko Tiikkaja
].. This part seems clear enough to me, and I don't think repeating that *three times* is necessary. We already say it twice. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [HACKERS] plpgsql.print_strict_params

2013-10-08 Thread Marko Tiikkaja
On 10/7/13 9:46 PM, Robert Haas wrote: Looks good to me. Committed. Thanks. Also huge thanks to Ian for a phenomenal first review. :-) Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] plpgsql.print_strict_params

2013-10-05 Thread Marko Tiikkaja
the option_value and either throw an error, or set the flag appropriately. Something like the attached? Regards, Marko Tiikkaja *** a/doc/src/sgml/plpgsql.sgml --- b/doc/src/sgml/plpgsql.sgml *** *** 1077,1082 END; --- 1077,1106 /para para

Re: [HACKERS] plpgsql.print_strict_params

2013-10-04 Thread Marko Tiikkaja
for the syntax? The only thing I can think of is print_strict_params and no_print_strict_params, and I'm not very fond of that. Also, in what contexts are unreserved keywords a problem in modern PL/PgSQL? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org

Re: [HACKERS] GSOC13 proposal - extend RETURNING syntax

2013-10-04 Thread Marko Tiikkaja
suggesting doesn't have this problem? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] plpgsql.print_strict_params

2013-09-28 Thread Marko Tiikkaja
On 2013-09-28 12:31, Ian Lawrence Barwick wrote: The patch looks good to me now; does the status need to be changed to Ready for Committer? Yes. Thanks for reviewing! Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-23 Thread Marko Tiikkaja
shortcut for other use cases. This idea is good, I like it. I could prepare a patch for this, unless someone else wants to? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-23 Thread Marko Tiikkaja
assertions can't be caught by exception handlers, but I don't know how that mechanism works so I'm not sure it's possible. I'll have to look into that. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-23 Thread Marko Tiikkaja
I'd say making the ASSERT keyword optional here would be very confusing. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-23 Thread Marko Tiikkaja
meant: RAISE WHEN true; would be equivalent to IF true THEN RAISE; END IF; Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-20 Thread Marko Tiikkaja
On 9/20/13 12:09 PM, Amit Khandekar wrote: On 16 September 2013 03:43, Marko Tiikkaja ma...@joh.to wrote: I think it would be extremely surprising if a command like that got optimized away based on a GUC, so I don't think that would be a good idea. In pl_gram.y, in the rule stmt_raise

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-20 Thread Marko Tiikkaja
PL/PgSQL better, and we should just start afresh. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-19 Thread Marko Tiikkaja
don't think so it is practical). It significantly increase a work that is necessary for error identification. I think that's a fair point. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-19 Thread Marko Tiikkaja
at least a) in 9.4, but I haven't yet looked at how it could be implemented. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] plpgsql.print_strict_params

2013-09-17 Thread Marko Tiikkaja
() and exec_get_dynquery_params() could do with some brief comments explaining their purpose. Agreed. Still agreeing with both of us, added a comment each. I also added the new keywords to the unreserved_keywords production, as per the instructions near the beginning of pl_gram.y. Regards, Marko Tiikkaja *** a/doc

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-17 Thread Marko Tiikkaja
for it working either way. Care to unravel yours a bit more? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Updatable view columns

2013-09-17 Thread Marko Tiikkaja
On 2013-09-17 12:53, Dean Rasheed wrote: Thanks for the review. Those changes all look sensible to me. Here's an updated patch incorporating all your fixes, and rebased to apply without offsets. Looks good to me. Marking this one ready for committer. Regards, Marko Tiikkaja -- Sent via

Re: [HACKERS] plpgsql.print_strict_params

2013-09-16 Thread Marko Tiikkaja
for a commitfest so please let me know if I'm missing something.) I personally think you did an excellent job. Huge thanks so far! Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org

Re: [HACKERS] Updatable view columns

2013-09-16 Thread Marko Tiikkaja
, Marko Tiikkaja diff --git a/doc/src/sgml/ref/create_view.sgml b/doc/src/sgml/ref/create_view.sgml index 4505290..e0fbe1e 100644 --- a/doc/src/sgml/ref/create_view.sgml +++ b/doc/src/sgml/ref/create_view.sgml @@ -440,7 +440,7 @@ CREATE VIEW pg_comedies AS programlisting CREATE VIEW comedies

Re: [HACKERS] plpgsql.print_strict_params

2013-09-15 Thread Marko Tiikkaja
On 15/09/2013 04:02, Peter Eisentraut wrote: On Fri, 2013-09-13 at 23:56 +0200, Marko Tiikkaja wrote: Attached is a patch for optionally printing more information on STRICT failures in PL/PgSQL: Please fix the tabs in the SGML files. Oops. Thanks. Attached an updated patch to fix the tabs

Re: [HACKERS] PL/pgSQL, RAISE and error context

2013-09-15 Thread Marko Tiikkaja
On 15/09/2013 13:50, I wrote: On 15/09/2013 04:05, Peter Eisentraut wrote: On Sat, 2013-09-14 at 04:58 +0200, Marko Tiikkaja wrote: The attached patch (based on Pavel's patch) changes the default to be slightly more verbose (the CONTEXT lines which were previously omitted will be visible

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-15 Thread Marko Tiikkaja
On 2013-09-15 16:34, Peter Eisentraut wrote: On Sat, 2013-09-14 at 20:47 +0200, Marko Tiikkaja wrote: Attached is a patch for supporting assertions in PL/PgSQL. These are similar to the Assert() backend macro: they can be disabled during compile time, but when enabled, abort execution

Re: [HACKERS] Where to load modules from?

2013-09-15 Thread Marko Tiikkaja
it. What should one do in that case? Writing a patch just to throw it away later because something's fundamentally broken (or unnacceptable) seems silly if people could have just looked at the original -HACKERS post and said this can't possibly work with your current design. Regards, Marko

Re: [HACKERS] [PATCH] pg_upgrade: Split off pg_fatal() from pg_log()

2013-09-15 Thread Marko Tiikkaja
: 1) Is there a reason for the fmt string not being const char*? You changed it for pg_log_v(), but not for pg_log() and pg_fatal(). 2) Allowing PG_FATAL to be passed to pg_log() seems weird, but I don't feel strongly about that. Other than that, the patch looks good to me. Regards, Marko

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-15 Thread Marko Tiikkaja
that would be a good idea. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Proposal: PL/PgSQL strict_mode

2013-09-14 Thread Marko Tiikkaja
, and got shot down quite quickly. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
this to the open commitfest, but feedback is greatly appreciated. Regards, Marko Tiikkaja *** a/doc/src/sgml/plpgsql.sgml --- b/doc/src/sgml/plpgsql.sgml *** *** 3528,3533 RAISE unique_violation USING MESSAGE = 'Duplicate user ID: ' || user_id; --- 3528,3596 /para /note

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
, not the postgres server binary. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Proposal: PL/PgSQL strict_mode

2013-09-14 Thread Marko Tiikkaja
this to the open commitfest in hopes of getting some feedback on this idea (I'm prepared to hear a lot of you're crazy!), but feel free to comment away any time you please. Well, I don't know if my feedback above is helpful, but there it is ;-) Thanks for your input! Regards, Marko Tiikkaja -- Sent via

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
On 2013-09-14 21:55, Jaime Casanova wrote: On Sat, Sep 14, 2013 at 1:52 PM, Marko Tiikkaja ma...@joh.to wrote: And by compile time here, I mean at the time when the PL/PgSQL function is compiled, not the postgres server binary. and compile time means when the function is created

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
for it. So can you redesign this without new keyword? I don't see an easy way to do that, but I'm not too familiar with PL/PgSQL's parser so maybe I'm just missing something. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
On 2013-09-14 22:40, I wrote: Someone may prove me wrong here, but to me it looks like this would only prevent ASSERT from being used as the name of a PL/PgSQL variable. The comment at the beginning of pl_scanner.c seems to suggest same. Regards, Marko Tiikkaja -- Sent via pgsql-hackers

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
looking into. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
and is fully reserved. CONSTRAINT? IS? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] Assertions in PL/PgSQL

2013-09-14 Thread Marko Tiikkaja
what you would put inside the function body for these two, either. Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

[HACKERS] plpgsql.print_strict_params

2013-09-13 Thread Marko Tiikkaja
by default to preserve old behaviour, but can be extremely useful when debugging code in test environments. I will add this to the open commitfest, but in the meanwhile, any feedback is appreciated. Regards, Marko Tiikkaja *** a/doc/src/sgml/plpgsql.sgml --- b/doc/src/sgml/plpgsql.sgml

Re: [HACKERS] plpgsql.print_strict_params

2013-09-13 Thread Marko Tiikkaja
think it would be better as a compile time option? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] plpgsql.print_strict_params

2013-09-13 Thread Marko Tiikkaja
On 2013-09-14 03:33, Alvaro Herrera wrote: Marko Tiikkaja wrote: I thought about that, but it seemed more like a runtime option to me. Any particular reason you think it would be better as a compile time option? Seems like something that would be useful to change per function, rather than

Re: [HACKERS] PL/pgSQL, RAISE and error context

2013-09-13 Thread Marko Tiikkaja
use the COMPACT mode. Any thoughts? Regards, Marko Tiikkaja *** a/doc/src/sgml/libpq.sgml --- b/doc/src/sgml/libpq.sgml *** *** 5418,5423 int PQsetClientEncoding(PGconn *replaceableconn/replaceable, const char *re --- 5418,5424 typedef enum { PQERRORS_TERSE

[HACKERS] Proposal: PL/PgSQL strict_mode

2013-09-13 Thread Marko Tiikkaja
away any time you please. Regards, Marko Tiikkaja [1]: http://www.postgresql.org/message-id/510bf731.5020...@gmx.net *** a/src/pl/plpgsql/src/pl_comp.c --- b/src/pl/plpgsql/src/pl_comp.c *** *** 351,356 do_compile(FunctionCallInfo fcinfo, --- 351,357 function

Re: [HACKERS] Proposal: PL/PgSQL strict_mode

2013-09-13 Thread Marko Tiikkaja
logic. The b) part here wasn't exactly true; you could use RETURNING TRUE INTO OK as INSERT/UPDATE/DELETE with RETURNING .. INTO raises an exception if it returns more than one row, but it's even more convoluted than the RETURNING TRUE INTO STRICT _OK, and it's repetitive. Regards, Marko

Re: [HACKERS] PL/pgSQL, RAISE and error context

2013-08-23 Thread Marko Tiikkaja
On 8/23/13 8:38 AM, Pavel Stehule wrote: 2013/8/22 Marko Tiikkaja ma...@joh.to I like the idea, but I think this should be a new verbosity level. With this patch you would have to go full VERBOSE just to debug PL/pgSQL code with NOTICEs and DEBUGs in it, and that output then becomes harder

Re: [HACKERS] PL/pgSQL PERFORM with CTE

2013-08-23 Thread Marko Tiikkaja
an entirely different thing be consistent? Regards, Marko Tiikkaja -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] PL/pgSQL, RAISE and error context

2013-08-22 Thread Marko Tiikkaja
the idea, but I think this should be a new verbosity level. With this patch you would have to go full VERBOSE just to debug PL/pgSQL code with NOTICEs and DEBUGs in it, and that output then becomes harder to parse with the useless C-code information. Regards, Marko Tiikkaja -- Sent via pgsql

[HACKERS] PL/pgSQL, RAISE and error context

2013-08-21 Thread Marko Tiikkaja
information. With a trivial change the last error could be: =# select bar(); ERROR: foo CONTEXT: PL/pgSQL function foof line 1 RAISE SQL statement SELECT foof() PL/pgSQL function bar line 1 at PERFORM which I find a lot better. Thoughts? Regards, Marko Tiikkaja -- Sent via pgsql-hackers

<    1   2   3   4   5   6   7   >