Re: \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless) - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)
Date
Msg-id alpine.DEB.2.20.1703251857540.8361@lancre
Whole thread Raw
In response to Re: [HACKERS] \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)  ("Daniel Verite" <daniel@manitou-mail.org>)
Responses Re: \if, \elseif, \else, \endif (was Re: PSQL commands:\quit_if, \quit_unless)
List pgsql-hackers
Hello Corey,

> v25, try 2:
>
> First file is what you were used to last time. 2nd and 3rd are changes
> since then based on feedback.

Patches do not apply cleanly.
Part 1 gets: error: patch failed: src/test/regress/parallel_schedule:89 error: src/test/regress/parallel_schedule:
patchdoes not apply
 

There is still the useless file, ok it is removed by part2. Could have 
been just one patch...

After a manual fix in parallel_schedule, make check is ok.

gather_boolean_expression:

ISTM that PQExpBuffer is partially a memory leak. Something should need to 
be freed?

I think that you should use appendPQExpBufferChar and Str instead of 
relying on the format variant which is probably expensive. Something like:
  if (num_options > 0)    append...Char(buf, ' ');  append...Str(buf, ...);

is_true_boolean_expression: "return (success) ? tf : false;"
Is this simply: "return success && tf;"?

Some functions have opt1, opt2, but some start at opt0. This does not look 
too consistent, although the inconsistency may be preexisting from your 
patch. Basically, there is a need for some more restructuring in 
"command.c".

-- 
Fabien.



pgsql-hackers by date:

Previous
From: Andreas Seltenreich
Date:
Subject: [sqlsmith] Failed assertion in _hash_kill_items/MarkBufferDirtyHint
Next
From: Thomas Munro
Date:
Subject: Re: delta relations in AFTER triggers