Thread: Comment bug in psql

Comment bug in psql

From
Martin Olsson
Date:
Hi!

I just found a bug in psql 7.0.3 (a FreeBSD 4.2 port).

1 db=# /* Foo bar
2 db*#    gazonk's gurka
3 db'#    2001            */
4 db'# CREATE TABLE foo (bar INTEGER);
5 db'# '
6 db*# */
7 db-# CREATE TABLE gazonk (blirp INTEGER);
8 ERROR:  Unterminated quoted string

1 Prompt is =, ok
  Start a comment

2 Prompt changes to *, ok
  Write more comments and include an apostrofe (')

3 Prompt changes to ', ERROR! You shouldn't enter this mode because of an
  apostrofe in commented text.
  Write more comments and end them, ERROR! The end of the comments aren't
  recognized.
The rest, 4-8, will be interpreted incorrectly.



/Martin Olsson   Sentor AB

"There is at least one incorrect statement in this text,
 but it may be this one!"

Re: Comment bug in psql

From
Bruce Momjian
Date:
Looks like this is fixed in 7.1RC4:


    test=> /* Foo bar
    test*>    gazonk's gurka
    test*>    2001            */
    test-> CREATE TABLE foo (bar INTEGER);
    CREATE

Thanks.

>
> Hi!
>
> I just found a bug in psql 7.0.3 (a FreeBSD 4.2 port).
>
> 1 db=# /* Foo bar
> 2 db*#    gazonk's gurka
> 3 db'#    2001            */
> 4 db'# CREATE TABLE foo (bar INTEGER);
> 5 db'# '
> 6 db*# */
> 7 db-# CREATE TABLE gazonk (blirp INTEGER);
> 8 ERROR:  Unterminated quoted string
>
> 1 Prompt is =, ok
>   Start a comment
>
> 2 Prompt changes to *, ok
>   Write more comments and include an apostrofe (')
>
> 3 Prompt changes to ', ERROR! You shouldn't enter this mode because of an
>   apostrofe in commented text.
>   Write more comments and end them, ERROR! The end of the comments aren't
>   recognized.
> The rest, 4-8, will be interpreted incorrectly.
>
>
>
> /Martin Olsson   Sentor AB
>
> "There is at least one incorrect statement in this text,
>  but it may be this one!"
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Don't 'kill -9' the postmaster
>


--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026