[SQL] Determining the DATE format with libpq - Mailing list pgsql-sql

From Sebastien FLAESCH
Subject [SQL] Determining the DATE format with libpq
Date
Msg-id 46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com
Whole thread Raw
Responses Re: [SQL] Determining the DATE format with libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-sql
Hi all,

The date format can be defined with SET DateStyle.

When fetching result set values using the libpq C API, we get plain text from PQgetvalue(), representing a date in the
currentformat.
 

We need to extract date parts (year/month/day) to fill our own DATE type structure...

Is there a way to know the current date format used in the SQL session?

Ideally, we expect a libpq API.

We cannot do a "SHOW DateStyle" each time we executing a SELECT!

Other DB client C APIs provide a C structure to hold DATE values so it's easy to get year/month/day parts.

Seb



pgsql-sql by date:

Previous
From: "Campbell, Lance"
Date:
Subject: Re: [SQL] how many times
Next
From: Tom Lane
Date:
Subject: Re: [SQL] Determining the DATE format with libpq