Skip site navigation (1) Skip section navigation (2)

Re: Ignored PostgreSQL SET command

From: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
To: Patrick Dunford <pdunford(dot)webs(at)clear(dot)net(dot)nz>
Cc: PostgreSQL List <pgsql-hackers(at)postgresql(dot)org>, php-general(at)lists(dot)php(dot)net
Subject: Re: Ignored PostgreSQL SET command
Date: 2001-01-02 07:47:06
Message-ID: 3A51877A.E18308CF@alumni.caltech.edu (view raw or flat)
Thread:
Lists: pgsql-hackers
> I have a line in a PHP script that looks like this:
>         $set=pg_exec($dbconn, "SET DATESTYLE TO 'European'"); //Set date format
> Since my ISP updated their server, this appears to be ignored as pgsql
> always returns dates in ISO format.
> 1. What is the default format of dates returned that I can ALWAYS rely on?

ISO. Or you can start up the backend with a different default.

> 2. Why is the command ignored?

It is not (or, is probably not). The variant "European" affects month
and day ordering when specifying a date or when formatting a date with
the "Postgres" or "SQL" format.

You probably want

  SET DATESTYLE TO 'SQL,European'

but ymmv. Check out the docs for more complete info, specifically the
chapter on data types.

                      - Thomas

In response to

pgsql-hackers by date

Next:From: Tom LaneDate: 2001-01-02 07:47:31
Subject: Re: [patch] src/include/storage/s_lock.h
Previous:From: Bruce MomjianDate: 2001-01-02 07:34:11
Subject: Re: [patch] src/include/storage/s_lock.h

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group