pg.ddx.io pgsql-sql@postgresql.org mailing list archive
help / color / mirror / Atom feedparser :parse error
7+ messages / 6 participants
[nested] [flat]
* parser :parse error
@ 1999-11-08 11:37 Frederic boucher <dziablo@hotmail.com>
1999-11-08 20:39 ` Re: [SQL] parser :parse error Bruce Momjian <maillist@candle.pha.pa.us>
1999-11-08 21:32 ` Re: [SQL] parser :parse error Peter Eisentraut <peter_e@gmx.net>
1999-11-08 22:42 ` Re: [SQL] parser :parse error Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
0 siblings, 3 replies; 7+ messages in thread
From: Frederic boucher @ 1999-11-08 11:37 UTC (permalink / raw)
To: pgsql-sql
Hi,
I'm trying to create a table with a default value for a field that containt
an 's ... And the server always tell me :
Error : parser: parse error at or near "s"
my create looks like :
create table tablename (
thefield varchar(50) default 'Fred''s car'
);
Any suggestion?
PS: This is more a linux question... but.. If I have a big file that
contains all my sql to create my tables structure. I want to run it by
doing "\i filename" but it scroll so fast I can't see when there is
error... is there a way to do a kind of "pipe into less"
\fb
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [SQL] parser :parse error
1999-11-08 11:37 parser :parse error Frederic boucher <dziablo@hotmail.com>
@ 1999-11-08 20:39 ` Bruce Momjian <maillist@candle.pha.pa.us>
1999-11-13 07:50 ` Re: [SQL] parser :parse error Tom Lane <tgl@sss.pgh.pa.us>
2 siblings, 1 reply; 7+ messages in thread
From: Bruce Momjian @ 1999-11-08 20:39 UTC (permalink / raw)
To: Frederic boucher <dziablo@hotmail.com>; +Cc: pgsql-sql
Works on current tree. Try 6.5.3.
> Hi,
>
> I'm trying to create a table with a default value for a field that containt
> an 's ... And the server always tell me :
>
> Error : parser: parse error at or near "s"
>
> my create looks like :
>
> create table tablename (
> thefield varchar(50) default 'Fred''s car'
> );
>
> Any suggestion?
>
> PS: This is more a linux question... but.. If I have a big file that
> contains all my sql to create my tables structure. I want to run it by
> doing "\i filename" but it scroll so fast I can't see when there is
> error... is there a way to do a kind of "pipe into less"
>
> \fb
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com
>
> ************
>
>
--
Bruce Momjian | http://www.op.net/~candle
maillist@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
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [SQL] parser :parse error
1999-11-08 11:37 parser :parse error Frederic boucher <dziablo@hotmail.com>
1999-11-08 20:39 ` Re: [SQL] parser :parse error Bruce Momjian <maillist@candle.pha.pa.us>
@ 1999-11-13 07:50 ` Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 0 replies; 7+ messages in thread
From: Tom Lane @ 1999-11-13 07:50 UTC (permalink / raw)
To: Bruce Momjian <maillist@candle.pha.pa.us>; +Cc: Frederic boucher <dziablo@hotmail.com>; pgsql-sql
[ sorry for not responding sooner, but I was on vacation... ]
>> create table tablename (
>> thefield varchar(50) default 'Fred''s car'
>> );
>>
>> Error : parser: parse error at or near "s"
Bruce Momjian <maillist@candle.pha.pa.us> writes:
> Works on current tree. Try 6.5.3.
It does work now, but is broken in 6.5.* and (AFAIK) all prior releases.
The problem is that the parser retranslates DEFAULT expressions into
source form after parsing them --- and the retranslation code is not
bright enough to provide quoting for embedded quotes and backslashes
in string constants. So the system ends up trying to process
DEFAULT 'Fred's car'
which obviously won't work.
Current sources fix this by eliminating the retranslation step. That's
a pretty major change, so I don't think it's practical/safe to backpatch
it into 6.5.*. If someone wants to fix this problem as a patch for
6.5.*, probably the best way to proceed would be to fix
backend/parser/gram.y's makeConstantList() to apply appropriate
backslash-quoting within string constants. I don't have the time or
interest to do it myself though.
regards, tom lane
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [SQL] parser :parse error
1999-11-08 11:37 parser :parse error Frederic boucher <dziablo@hotmail.com>
@ 1999-11-08 21:32 ` Peter Eisentraut <peter_e@gmx.net>
2 siblings, 0 replies; 7+ messages in thread
From: Peter Eisentraut @ 1999-11-08 21:32 UTC (permalink / raw)
To: Frederic boucher <dziablo@hotmail.com>; +Cc: pgsql-sql
On 1999-11-08, Frederic boucher mentioned:
> Hi,
>
> I'm trying to create a table with a default value for a field that containt
> an 's ... And the server always tell me :
>
> Error : parser: parse error at or near "s"
>
> my create looks like :
>
> create table tablename (
> thefield varchar(50) default 'Fred''s car'
> );
>
> Any suggestion?
Try 'Fred\'s car'.
>
> PS: This is more a linux question... but.. If I have a big file that
> contains all my sql to create my tables structure. I want to run it by
> doing "\i filename" but it scroll so fast I can't see when there is
> error... is there a way to do a kind of "pipe into less"
You can try \o outputfile, but I'm not sure if that works correctly. psql
has some problems in that regard. I fixed that in the new one, so if you
feel like pulling it from the current source. In particular, the new psql
lets you stop scripts on error.
But that new one is not completely bug free yet, of course.
On the other hand, what about this:
$ psql -f infile.sql -o outfile.txt
or
$ psql -f infile.sql > outfile.txt
or anything like that.
--
Peter Eisentraut Sernanders vaeg 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [SQL] parser :parse error
1999-11-08 11:37 parser :parse error Frederic boucher <dziablo@hotmail.com>
@ 1999-11-08 22:42 ` Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
2 siblings, 0 replies; 7+ messages in thread
From: Moray McConnachie @ 1999-11-08 22:42 UTC (permalink / raw)
To: Frederic boucher <dziablo@hotmail.com>; pgsql-sql
> PS: This is more a linux question... but.. If I have a big file that
> contains all my sql to create my tables structure. I want to run it by
> doing "\i filename" but it scroll so fast I can't see when there is
> error... is there a way to do a kind of "pipe into less"
psql -d database -c '\i filename' ¦ more
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [SQL] parser :parse error
@ 1999-11-08 21:37 Jacob Christen <jacob-christen@home.com>
0 siblings, 0 replies; 7+ messages in thread
From: Jacob Christen @ 1999-11-08 21:37 UTC (permalink / raw)
To: pgsql-sql
>> PS: This is more a linux question... but.. If I have a big file that
>> contains all my sql to create my tables structure. I want to run it by
>> doing "\i filename" but it scroll so fast I can't see when there is
>> error... is there a way to do a kind of "pipe into less"
in bash or ksh:
export PAGER=less
psql seems to use this to page all output if set (if not set i get no
paging)
^ permalink raw reply [nested|flat] 7+ messages in thread
* Re: [SQL] parser :parse error
@ 1999-11-09 05:28 Frederic boucher <dziablo@hotmail.com>
0 siblings, 0 replies; 7+ messages in thread
From: Frederic boucher @ 1999-11-09 05:28 UTC (permalink / raw)
To: pgsql-sql
>
>Try 'Fred\'s car'.
>
Ok I'll take a look at it.. thanks
>On the other hand, what about this:
>$ psql -f infile.sql -o outfile.txt
>or
>$ psql -f infile.sql > outfile.txt
>or anything like that.
The only problem when I use the second one is that the parser error are in
the err stream So I've got only
CREATE
CREATE
DONE
...etc..
in the out file and When I try to do a 2>err.file it doesn't understand...
Anyway I'll try the -o outfile
______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com
^ permalink raw reply [nested|flat] 7+ messages in thread
end of thread, other threads:[~1999-11-13 07:50 UTC | newest]
Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-11-08 11:37 parser :parse error Frederic boucher <dziablo@hotmail.com>
1999-11-08 20:39 ` Bruce Momjian <maillist@candle.pha.pa.us>
1999-11-13 07:50 ` Tom Lane <tgl@sss.pgh.pa.us>
1999-11-08 21:32 ` Peter Eisentraut <peter_e@gmx.net>
1999-11-08 22:42 ` Moray McConnachie <moray.mcconnachie@computing-services.oxford.ac.uk>
1999-11-08 21:37 Re: [SQL] parser :parse error Jacob Christen <jacob-christen@home.com>
1999-11-09 05:28 Re: [SQL] parser :parse error Frederic boucher <dziablo@hotmail.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