Determining the DATE format with libpq

From: Sebastien FLAESCH <sf(at)4js(dot)com>
To: "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Determining the DATE format with libpq
Date: 2017-08-24 15:21:55
Message-ID: 46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 current format.

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

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2017-08-24 15:26:57 Re: Determining the DATE format with libpq
Previous Message Campbell, Lance 2017-08-24 14:46:27 Re: how many times