Skip site navigation (1) Skip section navigation (2)

Re: [GENERAL] Debugging SQL queries

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Anastasios Hatzis <ahatzis(at)gmx(dot)net>
Cc: pgsql-general(at)postgresql(dot)org, pgadmin-hackers(at)postgresql(dot)org
Subject: Re: [GENERAL] Debugging SQL queries
Date: 2006-05-11 14:00:17
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgadmin-hackerspgsql-general
Anastasios Hatzis <ahatzis(at)gmx(dot)net> writes:
> I have sometimes very long queries, for example in setup-purposed sql 
> file where plenty of tables of a new database are created in a single 
> transaction. 600 lines of code or more is common. Sometimes, while 
> developing, an error may appear after submitting such a query for 
> testing purposes via pgAdmin III query dialog. pgAdmin III displays the 
> PostgreSQL error, like shown below (example)

>     syntax error at or near "1" at character 2641

> My problem is that I don't know where the given character number is 
> inside the query/file.

You should complain to the pgAdmin people that they are delivering an
inadequate error message.  psql, for example, does something like this
in similar situations:

regression=# select 1 + 1 +1
regression-# + 1 + 1 1 + 1
regression-# + 1 + 1;
ERROR:  syntax error at or near "1" at character 26
LINE 2: + 1 + 1 1 + 1

If you ask me, a GUI that fails to make use of the cursor-position info
that the backend supplies is a poor excuse for a GUI.  We have actually
removed the "at character N" bit from the default message format in CVS
tip, on the assumption that every client app worth worrying about has
got better methods than that for showing the error cursor position.
pgAdmin needs to catch up before 8.2 comes out ;-)

			regards, tom lane

In response to


pgadmin-hackers by date

Next:From: Dave PageDate: 2006-05-11 14:23:50
Subject: Re: [GENERAL] Debugging SQL queries
Previous:From: chris smithDate: 2006-05-11 13:14:58
Subject: Re: Debugging SQL queries

pgsql-general by date

Next:From: Mark CampbellDate: 2006-05-11 14:00:30
Subject: Compiling on 8.1.3 on Openserver 5.05
Previous:From: Tom LaneDate: 2006-05-11 13:48:08
Subject: Re: Recovery problem with PostgreSQL

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group