Re: [BUGS] psql history and "-- lines"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [BUGS] psql history and "-- lines"
Дата
Msg-id 19006.1494033923@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [BUGS] psql history and "-- lines"  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: [BUGS] psql history and "-- lines"  (Дилян Палаузов<dpa-postgres@aegee.org>)
Список pgsql-bugs
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> On Fri, May 5, 2017 at 1:52 PM, Дилян Палаузов <dpa-postgres@aegee.org>
> wrote:
>> Could you plexe alter psql, so that it logs two lines in the history for
>> the mentioned case?

> It probably should only behave as you suggest in --single-line mode...

I'm not exactly convinced that the proposed change would be an
improvement.  Consider code along the lines of (actual example
from system_views.sql):

--
-- Redeclare built-in functions that need default values attached to their
-- arguments.  It's impractical to set those up directly in pg_proc.h because
-- of the complexity and platform-dependency of the expression tree
-- representation.  (Note that internal functions still have to have entries
-- in pg_proc.h; we are merely causing their proargnames and proargdefaults
-- to get filled in.)
--

CREATE OR REPLACE FUNCTION pg_start_backup(label text, fast boolean DEFAULT false, exclusive boolean DEFAULT true)
RETURNSpg_lsn STRICT VOLATILE LANGUAGE internal AS 'pg_start_backup' PARALLEL RESTRICTED; 

Would you really want each of those -- lines to be their own history
entry?

Another angle to think about is /* ... */ comments, which you really
can't break into separate lines without creating a syntactically-invalid
mess.  That type of comment also creates the possibility of input like

/* foo* bar */ select ...

There isn't any very nice way to separate this comment from the SQL query
for history purposes.

In my own usage, I think having leading comments being treated as
part of the SQL command is a good thing --- they're sort of a unit,
in most cases.
        regards, tom lane


--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

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

Предыдущее
От: Bill Parker
Дата:
Сообщение: Re: [BUGS] Postgresql and Clang Static Analyzer
Следующее
От: rinto r john
Дата:
Сообщение: [BUGS] error- how to solve-reg