Re: How to get last Error Message/Code - Mailing list pgsql-general

From John R Pierce
Subject Re: How to get last Error Message/Code
Date
Msg-id 4E3A4249.4090202@hogranch.com
Whole thread Raw
In response to How to get last Error Message/Code  (Earth Analizer <analizer1@gmail.com>)
List pgsql-general
On 08/03/11 10:03 PM, Earth Analizer wrote:
> Hi,
>
> I am new to Postgres and I would like to know how I can get the last
> error message.
> I am using a programming language called "Paradox" and, when an error
> occurs,
> it converts the Postgres error code to its own error code.
> Sometimes Paradox displays a funny message, if it does not recognize
> the code and
> the error message it displays gives me no clue for what actually happened.
>
> if anyone knows the solution, please let me know.
>
> Thank you in advance.
> Cheers!

any SQL errors should be in postgres' logfile, which typically is
accessible only to the postgres user, in the pg data/pg_log directory

I usually like to make a few tweaks to the logging defaults, like


     log_line_prefix = '%m %u@%d[%p]:'

which will timestamp the logs, and give you user@database[pid]: in front
of each entry, like...

2011-08-04 02:06:46.681 PDT postgres@postgres[12927]:ERROR:  column
"junk" does not exist at character 8
2011-08-04 02:06:46.681 PDT postgres@postgres[12927]:STATEMENT:  select
junk;


--
john r pierce                            N 37, W 122
santa cruz ca                         mid-left coast


pgsql-general by date:

Previous
From: Earth Analizer
Date:
Subject: How to get last Error Message/Code
Next
From: Adarsh Sharma
Date:
Subject: Re: Server Not Running