agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Sebastien FLAESCH <sf@4js.com>
To: pgsql-sql@postgresql.org <pgsql-sql@postgresql.org>
Subject: Determining the DATE format with libpq
Date: Thu, 24 Aug 2017 17:21:55 +0200
Message-ID: <46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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


-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)  latest in thread

Message-ID: <46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com>
Permalink:  ../46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com/
Also on:    postgresql.org/message-id/46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: sf@4js.com
  Subject: Re: Determining the DATE format with libpq
  In-Reply-To: <46935bcd-5754-9deb-fc63-8162bcdd4c46@4js.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox