Debugging SQL queries

Поиск
Список
Период
Сортировка
От Anastasios Hatzis
Тема Debugging SQL queries
Дата
Msg-id 4462F2E9.6020108@gmx.net
обсуждение исходный текст
Ответы Re: Debugging SQL queries  (Douglas McNaught <doug@mcnaught.org>)
Re: Debugging SQL queries  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
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

According my current PostgreSQL configuration error message looks
similar in the log files:

    2006-05-11 09:51:55 ERROR:  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. I can search in my code editors (e.g. those of
Eclipse IDE) for line number + character number in given line number...
but I can not search for an overall character number. Counting all
characters from 1 to 2641 or any other character number would be really
frustrating in such big queries and it wouldn't be satisfying for me to
split the sql file into multiple smaller queries. How can I configure
PostgreSQL to get line number + character number in that line in the
error statements, or which other solution may help?

Development version is PostgreSQL 8.1.3 on Windows XP Pro.

Many thanks!

Anastasios

В списке pgsql-general по дате отправления:

Предыдущее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: compiling postgres on solaris and DBD::Pg
Следующее
От: Sim Zacks
Дата:
Сообщение: Re: understanding explain data