From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Stuart Cooper" <stuart(dot)cooper(at)gmail(dot)com> |
Cc: | jws <jsacksteder(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Can psql show me where my script is broken? |
Date: | 2007-03-09 06:17:22 |
Message-ID: | 21927.1173421042@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Stuart Cooper" <stuart(dot)cooper(at)gmail(dot)com> writes:
>> I have an enormous sql script with an incorrect insert line somewhere.
>> I can echo the commands to stdout as they are executed, but apparently
>> errors go to stderr. How can I determine where the problem is?
> from memory, if you invoke it from the shell with psql [connection
> options] -f filename.sql
> you'll get the line number of filename.sql that has the error.
Any reasonably recent version of postgres will give you a fairly decent
pointer to syntax errors. For example:
$ cat bogus.sql
select *
from
foo bar baz
where 1=0;
$ psql regression
...
regression=# \i bogus.sql
psql:bogus.sql:4: ERROR: syntax error at or near "baz"
LINE 3: foo bar baz
^
regression=#
If you feel you're being left in the dark, please provide some specifics
about what the error is and what PG version you're using.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Mario Guenterberg | 2007-03-09 08:10:27 | Re: Anyone know a good opensource CRM that actually installs with Posgtres? |
Previous Message | Patrick TJ McPhee | 2007-03-09 06:12:27 | Re: OT: Canadian Tax Database |