Re: Correct handling of blank/commented lines in PSQL interactive-mode history

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема Re: Correct handling of blank/commented lines in PSQL interactive-mode history
Дата
Msg-id 202111291523.s3c73i5qvi7u@alvherre.pgsql
обсуждение исходный текст
Ответ на Re: Correct handling of blank/commented lines in PSQL interactive-mode history  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Correct handling of blank/commented lines in PSQL interactive-mode history  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On 2021-Nov-29, Tom Lane wrote:

> Greg's patch would fix this specifically by ensuring that the line
> with the space and comment is treated as a separate history entry.
> So I don't really see that as a separate bug.  Or, if you will,
> the fact that people see it as a bug confirms that such a line
> should be treated as a separate history entry.

I wonder if these things would be easier to deal with or more convenient
if we thought of -- as starting a line-scoped comment, and /* */ as
starting a query-scoped comment, and treat both types differently.  That
is, a -- comment would not be part of the subsequent command (and they
would become two separate history entries), but a /* */ comment would be
part of the command, and so both the comment and the query would be
saved as a single history entry.

So with ignorespace, then you can get either behavior:

 /* don't put neither comment nor command in history */
select 1;
and then nothing gets put in history; but if you do

 -- don't put this *comment* in history, but do put command
select 1;

then the comment is ignored, but the query does end up in history.


Perhaps one problem is how to behave with intra-query -- comments.
Surely they should not split the command in three parts, but I'm not
sure to what extent that is possible to implement.

This doesn't actually fix the issue that Greg was complaining about,
because his problem is precisely the -- comments.  But would Greg and
other users be satisfied if we made that distinction?

-- 
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Justin Pryzby
Дата:
Сообщение: Re: Lots of memory allocated when reassigning Large Objects
Следующее
От: Laurenz Albe
Дата:
Сообщение: Re: Correct handling of blank/commented lines in PSQL interactive-mode history