pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
parse error at or near "(" -- Huh???
6+ messages / 5 participants
[nested] [flat]

* parse error at or near "(" -- Huh???
@ 2004-12-09 20:19 Alex Beamish <talexb@gmail.com>
  2004-12-13 02:18 ` Re: parse error at or near "(" -- Huh??? Michael Fuhr <mike@fuhr.org>
  2004-12-13 02:45 ` Re: parse error at or near "(" -- Huh??? Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 6+ messages in thread

From: Alex Beamish @ 2004-12-09 20:19 UTC (permalink / raw)
  To: pgsql-sql

Hi,

I'm getting a frustrating error

  ERROR:  parser: parse error at or near "(" at character 201

in a CREATE TABLE statement from an SQL script that I'm running from
within a Perl script. When I run the same script from the command
line, either as a regular user or as root, it works fine.

The SQL is
---------------------------------------------------------
CREATE SEQUENCE "users_id"
	START 1 INCREMENT 1 MAXVALUE 2147483647 MINVALUE 1 CACHE 1;

CREATE TABLE "users" (
	"u_id" integer DEFAULT nextval('users_id'::text) NOT NULL,
	"u_name" text NOT NULL,
	"u_password" text NOT NULL,
	"u_console_flag" integer DEFAULT 0,
	Constraint "users_pkey" Primary Key ("u_id")
);
---------------------------------------------------------

The 'console_flag' field was recently added and is close-ish to the
point that I think the parser is failing. And speaking of that, how I
am to interpret 'character 201' -- should I collapse the SQL into it's
minimal state (least number spaces) and go from that?

Thanks.

Alex

ps Tried to join the list using 
http://webmail.postgresql.org/mj/mj_wwwusr?domain=postgresql.org&func=lists-long-full&extra=...
but got a server timeout. :(



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

* Re: parse error at or near "(" -- Huh???
  2004-12-09 20:19 parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
@ 2004-12-13 02:18 ` Michael Fuhr <mike@fuhr.org>
  2004-12-13 03:43   ` Re: parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Michael Fuhr @ 2004-12-13 02:18 UTC (permalink / raw)
  To: Alex Beamish <talexb@gmail.com>; +Cc: pgsql-sql

On Thu, Dec 09, 2004 at 03:19:56PM -0500, Alex Beamish wrote:

> I'm getting a frustrating error
> 
>   ERROR:  parser: parse error at or near "(" at character 201
> 
> in a CREATE TABLE statement from an SQL script that I'm running from
> within a Perl script. When I run the same script from the command
> line, either as a regular user or as root, it works fine.

Your SQL statements ran fine for me, so please show us a small but
complete Perl script that duplicates the problem.

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/



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

* Re: parse error at or near "(" -- Huh???
  2004-12-09 20:19 parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
  2004-12-13 02:18 ` Re: parse error at or near "(" -- Huh??? Michael Fuhr <mike@fuhr.org>
@ 2004-12-13 03:43   ` Alex Beamish <talexb@gmail.com>
  0 siblings, 0 replies; 6+ messages in thread

From: Alex Beamish @ 2004-12-13 03:43 UTC (permalink / raw)
  To: pgsql-sql

On Sun, 12 Dec 2004 19:18:00 -0700, Michael Fuhr <mike@fuhr.org> wrote:
> On Thu, Dec 09, 2004 at 03:19:56PM -0500, Alex Beamish wrote:
> 
> > I'm getting a frustrating error
> >
> >   ERROR:  parser: parse error at or near "(" at character 201
> >
> > in a CREATE TABLE statement from an SQL script that I'm running from
> > within a Perl script. When I run the same script from the command
> > line, either as a regular user or as root, it works fine.
> 
> Your SQL statements ran fine for me, so please show us a small but
> complete Perl script that duplicates the problem.

Michael, Tom,

Thank you both for your responses .. I discovered that, while I was
editting what I thought was the running script, I was actually running
an earlier (wrong) version extracted a moment earlier from the version
control system, in a paralell directory. This became obvious when I
deleted the offending line and the error remained exactly the same.

However, I am intrigued to find out about the character offset that
appears in the error. How is that calculated? This would be useful
diagnostic information to have in the future.

Thanks!

Alex



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

* Re: parse error at or near "(" -- Huh???
  2004-12-09 20:19 parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
@ 2004-12-13 02:45 ` Tom Lane <tgl@sss.pgh.pa.us>
  2004-12-13 03:57   ` Re: parse error at or near "(" -- Huh??? Kenneth Gonsalves <lawgon@thenilgiris.com>
  1 sibling, 1 reply; 6+ messages in thread

From: Tom Lane @ 2004-12-13 02:45 UTC (permalink / raw)
  To: Alex Beamish <talexb@gmail.com>; +Cc: pgsql-sql

Alex Beamish <talexb@gmail.com> writes:
> I'm getting a frustrating error
>   ERROR:  parser: parse error at or near "(" at character 201
> in a CREATE TABLE statement from an SQL script that I'm running from
> within a Perl script. When I run the same script from the command
> line, either as a regular user or as root, it works fine.

One would have to suppose that the Perl environment is somehow munging
the SQL commands you think you are sending.  Try enabling statement
logging on the server side --- when you can see what was really sent,
all will probably become much clearer.

> And speaking of that, how I
> am to interpret 'character 201' -- should I collapse the SQL into it's
> minimal state (least number spaces) and go from that?

One character per character, whether that be a visible character or
whitespace (including newlines).  Collapsing out whitespace is
definitely not going to give you the right count.

			regards, tom lane



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

* Re: parse error at or near "(" -- Huh???
  2004-12-09 20:19 parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
  2004-12-13 02:45 ` Re: parse error at or near "(" -- Huh??? Tom Lane <tgl@sss.pgh.pa.us>
@ 2004-12-13 03:57   ` Kenneth Gonsalves <lawgon@thenilgiris.com>
  2004-12-13 08:44     ` Re: parse error at or near "(" -- Huh??? D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 1 reply; 6+ messages in thread

From: Kenneth Gonsalves @ 2004-12-13 03:57 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; Alex Beamish <talexb@gmail.com>; +Cc: pgsql-sql

On Monday 13 December 2004 08:15 am, Tom Lane wrote:
>
> One character per character, whether that be a visible character or
> whitespace (including newlines).  Collapsing out whitespace is
> definitely not going to give you the right count.

and while on this topic, how does one interpret the line numbers one gets 
when running psql -f to create tables?



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

* Re: parse error at or near "(" -- Huh???
  2004-12-09 20:19 parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
  2004-12-13 02:45 ` Re: parse error at or near "(" -- Huh??? Tom Lane <tgl@sss.pgh.pa.us>
  2004-12-13 03:57   ` Re: parse error at or near "(" -- Huh??? Kenneth Gonsalves <lawgon@thenilgiris.com>
@ 2004-12-13 08:44     ` D'Arcy J.M. Cain <darcy@druid.net>
  0 siblings, 0 replies; 6+ messages in thread

From: D'Arcy J.M. Cain @ 2004-12-13 08:44 UTC (permalink / raw)
  To: Kenneth Gonsalves <lawgon@thenilgiris.com>; +Cc: tgl@sss.pgh.pa.us; talexb@gmail.com; pgsql-sql

On Mon, 13 Dec 2004 09:27:04 +0530
Kenneth Gonsalves <lawgon@thenilgiris.com> wrote:
> and while on this topic, how does one interpret the line numbers one
> gets when running psql -f to create tables?

Forget about line numbers.  Add the -e option and your statements will
show up in your output.  Here is a sample (Unix) command line that I
commonly use to run statements from a file:

psql table -f in.file -e > out.file 2>&1

Now I can search the file for "ERROR" and see exactly what preceded it.

-- 
D'Arcy J.M. Cain <darcy@druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



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


end of thread, other threads:[~2004-12-13 08:44 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 20:19 parse error at or near "(" -- Huh??? Alex Beamish <talexb@gmail.com>
2004-12-13 02:18 ` Michael Fuhr <mike@fuhr.org>
2004-12-13 03:43   ` Alex Beamish <talexb@gmail.com>
2004-12-13 02:45 ` Tom Lane <tgl@sss.pgh.pa.us>
2004-12-13 03:57   ` Kenneth Gonsalves <lawgon@thenilgiris.com>
2004-12-13 08:44     ` D'Arcy J.M. Cain <darcy@druid.net>

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