Re: pgbench - allow backslash continuations in \set expressions
От | Fabien COELHO |
---|---|
Тема | Re: pgbench - allow backslash continuations in \set expressions |
Дата | |
Msg-id | alpine.DEB.2.20.1611010834100.12273@lancre обсуждение исходный текст |
Ответ на | Re: pgbench - allow backslash continuations in \set expressions (Rafia Sabih <rafia.sabih@enterprisedb.com>) |
Список | pgsql-hackers |
Hello Rafia, > Seems like an interesting addition to pgbench interface, but not sure where > it's required, it'll be good if you may provide some cases where it's > utility can be witnessed. Something like where you absolutely need > continuations in expression. It is never "absolutely needed", you can always put the expression on one longer line. As an long line example, supposing some other currently submitted patches are committed to pgbench, for implementing tpc-b according to the specification one may write the following: \set bid CASE WHEN random(0, 99) < 85 THEN :tbid ELSE :abid + (:abid >= :tbid) END or \set bid \ CASE WHEN random(0, 99) < 85 \ THEN :tbid \ ELSE :abid + (:abid >= :tbid) \ END I find the second version more readable, but it is a really matter of taste, obviously. > While applying it is giving some trailing whitespace errors, please > correct them. sh> git checkout -b tmp sh> git apply ~/pgbench-set-continuation-1.patch sh> git commit -a sh> I do not get any errors, and I have not found any trailing spaces in the patch. Could you give me the precise error message you got? > As an additional comment you may consider reformatting > following snippet > >> {continuation} { /* ignore */ } >> >> as > >> {continuation} { >> /* ignore */ >> } Hmmm... Other lex rules to ignore spaces use the one line syntax, I would prefer to keep it the same as those. -- Fabien.
В списке pgsql-hackers по дате отправления: