2017-05-09 20:37 GMT+02:00 Fabien COELHO <coe...@cri.ensmp.fr>:

>
> Hello Pavel,
>
> [...] it is little bit worse. I cannot to distinguish between SELECT\gdesc
>> and TRUNCATE xxx\gdesc . All are valid commands and produce empty result,
>> so result of \gdesc command should be empty result too.
>>
>> postgres=# truncate table xx\gdesc
>> ┌──────┬──────┐
>> │ Name │ Type │
>> ╞══════╪══════╡
>> └──────┴──────┘
>> (0 rows)
>>
>
> Hmmm. At least it is better than the previous error.
>
> What about detecting the empty result (eg PQntuples()==0?) and writing
> "Empty result" instead of the strange looking empty table above? That would
> just mean skipping the PrintQueryResult call in this case?


PQntuples == 0 every time - the query is not executed.

I am not sure, what is more correct. The "Empty result" string is not used
every time in psql. For the case "SELECT;" the empty table is correct. For
TRUNCATE and similar command I am not sure. The empty table is maybe
unusual, but it is valid - like "SELECT;". The implementation is not
problem in any case. The question is what is more natural for users a) the
string "Empty result", b) empty table.

I prefer @b due consistency with current behave (that is only reason, I
have not any other).

postgres=# select 'ahoj' where false;
┌──────────┐
│ ?column? │
╞══════════╡
└──────────┘
(0 rows)



>
>
> --
> Fabien.

Reply via email to