pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
psql treat backslash which is not the first character in the input line as meta-command
3+ messages / 2 participants
[nested] [flat]

* psql treat backslash which is not the first character in the input line as meta-command
@ 2014-10-29 09:09 chenhj <chjischj@163.com>
  2014-10-29 09:25 ` Re: psql treat backslash which is not the first character in the input line as meta-command Pavel Stehule <pavel.stehule@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: chenhj @ 2014-10-29 09:09 UTC (permalink / raw)
  To: pgsql-bugs

Hi,all


psql treat backslash which is not the first character in the input line as meta-command,and failed to execute the next query.
It seems to be a bug.


Sample1:
postgres=# select \1 set c2=c1%3 ;
Invalid command \1. Try \? for help.
postgres-# select 1;
ERROR:  syntax error at or near "select"
LINE 2: select 1;
        ^




Sample2:
postgres=# a \l 
                              List of databases
   Name    | Owner  | Encoding  |  Collate   |   Ctype    | Access privileges 
-----------+--------+-----------+------------+------------+-------------------
 postgres  | chenhj | SQL_ASCII | C          | C          | 
 template0 | chenhj | SQL_ASCII | C          | C          | =c/chenhj        +
           |        |           |            |            | chenhj=CTc/chenhj
 template1 | chenhj | SQL_ASCII | C          | C          | =c/chenhj        +
           |        |           |            |            | chenhj=CTc/chenhj
(6 rows)


postgres-# select 1;
ERROR:  syntax error at or near "a"
LINE 1: a 
        ^


Regards,
Chen Huajun

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: psql treat backslash which is not the first character in the input line as meta-command
  2014-10-29 09:09 psql treat backslash which is not the first character in the input line as meta-command chenhj <chjischj@163.com>
@ 2014-10-29 09:25 ` Pavel Stehule <pavel.stehule@gmail.com>
  2014-10-29 09:38   ` Re: psql treat backslash which is not the first character in the input line as meta-command chenhj <chjischj@163.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Pavel Stehule @ 2014-10-29 09:25 UTC (permalink / raw)
  To: chenhj <chjischj@163.com>; +Cc: pgsql-bugs

Hi

It is not bug. Upi can you a backslash commands for entering query

postgres=# select 10 \g ~foo
postgres=# \! cat foo
 ?column?
----------
       10
(1 row)

postgres=# select 10 as xx \gset
postgres=# \echo :xx
10

regards

Pavel Stehule

2014-10-29 10:09 GMT+01:00 chenhj <chjischj@163.com>:

> Hi,all
>
> psql treat backslash which is not the first character in the input line
> as meta-command,and failed to execute the next query.
> It seems to be a bug.
>
> Sample1:
> postgres=# select \1 set c2=c1%3 ;
> Invalid command \1. Try \? for help.
> postgres-# select 1;
> ERROR:  syntax error at or near "select"
> LINE 2: select 1;
>         ^
>
>
> Sample2:
> postgres=# a \l
>                               List of databases
>    Name    | Owner  | Encoding  |  Collate   |   Ctype    | Access
> privileges
>
> -----------+--------+-----------+------------+------------+-------------------
>  postgres  | chenhj | SQL_ASCII | C          | C          |
>  template0 | chenhj | SQL_ASCII | C          | C          | =c/chenhj
>    +
>            |        |           |            |            |
> chenhj=CTc/chenhj
>  template1 | chenhj | SQL_ASCII | C          | C          | =c/chenhj
>    +
>            |        |           |            |            |
> chenhj=CTc/chenhj
> (6 rows)
>
> postgres-# select 1;
> ERROR:  syntax error at or near "a"
> LINE 1: a
>         ^
>
> Regards,
> Chen Huajun
>

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: psql treat backslash which is not the first character in the input line as meta-command
  2014-10-29 09:09 psql treat backslash which is not the first character in the input line as meta-command chenhj <chjischj@163.com>
  2014-10-29 09:25 ` Re: psql treat backslash which is not the first character in the input line as meta-command Pavel Stehule <pavel.stehule@gmail.com>
@ 2014-10-29 09:38   ` chenhj <chjischj@163.com>
  0 siblings, 0 replies; 3+ messages in thread

From: chenhj @ 2014-10-29 09:38 UTC (permalink / raw)
  To: Pavel Stehule <pavel.stehule@gmail.com>; +Cc: pgsql-bugs

Hi


I understand,Thanks!


regards,
Chen Huajun
At 2014-10-29 17:25:23, "Pavel Stehule" <pavel.stehule@gmail.com> wrote:

Hi


It is not bug. Upi can you a backslash commands for entering query

postgres=# select 10 \g ~foo
postgres=# \! cat foo
 ?column?
----------
       10
(1 row)

postgres=# select 10 as xx \gset
postgres=# \echo :xx
10


regards


Pavel Stehule



2014-10-29 10:09 GMT+01:00 chenhj <chjischj@163.com>:

Hi,all


psql treat backslash which is not the first character in the input line as meta-command,and failed to execute the next query.
It seems to be a bug.


Sample1:
postgres=# select \1 set c2=c1%3 ;
Invalid command \1. Try \? for help.
postgres-# select 1;
ERROR:  syntax error at or near "select"
LINE 2: select 1;
        ^




Sample2:
postgres=# a \l 
                              List of databases
   Name    | Owner  | Encoding  |  Collate   |   Ctype    | Access privileges 
-----------+--------+-----------+------------+------------+-------------------
 postgres  | chenhj | SQL_ASCII | C          | C          | 
 template0 | chenhj | SQL_ASCII | C          | C          | =c/chenhj        +
           |        |           |            |            | chenhj=CTc/chenhj
 template1 | chenhj | SQL_ASCII | C          | C          | =c/chenhj        +
           |        |           |            |            | chenhj=CTc/chenhj
(6 rows)


postgres-# select 1;
ERROR:  syntax error at or near "a"
LINE 1: a 
        ^


Regards,
Chen Huajun



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2014-10-29 09:38 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2014-10-29 09:09 psql treat backslash which is not the first character in the input line as meta-command chenhj <chjischj@163.com>
2014-10-29 09:25 ` Pavel Stehule <pavel.stehule@gmail.com>
2014-10-29 09:38   ` chenhj <chjischj@163.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox