From: | "Aleksey M Boltenkov" <holybolt(at)rambler(dot)ru> |
---|---|
To: | holybolt(at)rambler(dot)ru |
Cc: | "pgsql-general" <pgsql-general(at)postgresql(dot)org>, tgl(at)sss(dot)pgh(dot)pa(dot)us |
Subject: | RE: bug in psql? |
Date: | 2020-08-15 06:51:53 |
Message-ID: | 1597474313.828133.30766.37520@mail.rambler.ru |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
15.08.2020, 09:46, Aleksey M Boltenkov <holybolt(at)rambler(dot)ru>
15.08.2020, 08:56, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>"Aleksey M Boltenkov" <holybolt(at)rambler(dot)ru>
writes:
> Is this a bug?
> pg01:5432 postgres(at)db=# select 'any expression'any expression\d+;
No. The "\d+;" is taken as a backslash command, and is executed.
The rest of what you typed is still waiting in the query buffer.
It's bit weird perhaps, since \d seems like a "do-something"
command rather than a query buffer editing command. But
psql uses the same rules for both cases.
regards, tom lane
Yes, i have used it for a long, but it was always wellformed, so malformed
query was some kind of surprise.
select format('insert into x.y ( field, ... ) select val, ... from %I.%I on
conflict ( constraint ) do nothing;\dti+ x.y*', (regexp_match(tablename,
'\d[\d_]+$'))[1], schemaname, tablename) from pg_tables where schemaname =
'x' and tablename ~ '^y' order by 1;
insert into x.y ( field, ... ) select '2020_07_29'::date, field, ... from
x.y_archive_2020_07_29 on conflict ( constraint ) do nothing;\dti+
x.y_new_scheme*
insert into x.y ( field, ... ) select '2020_08_05'::date, field, ... from
x.y_archive_2020_08_05 on conflict ( constraint ) do nothing;\dti+
x.y_new_scheme*
insert into x.y ( field, ... ) select '2020_08_12'::date, field, ... from
x.y_archive_2020_08_12 on conflict ( constraint ) do nothing;\dti+
x.y_new_scheme*
\gexec
Aleksey M Boltenkov.
Sorry, \gexec does not work, copy and paste.
Aleksey M Boltenkov.
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksey M Boltenkov | 2020-08-15 06:54:26 | RE: bug in psql? |
Previous Message | Pavel Stehule | 2020-08-15 06:49:13 | Re: bug in psql? |