pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedSystem Date
5+ messages / 4 participants
[nested] [flat]
* System Date
@ 2007-01-18 22:42 Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
0 siblings, 1 reply; 5+ messages in thread
From: Negandhi, Nishith @ 2007-01-18 22:42 UTC (permalink / raw)
To: pgsql-admin
Hi,
How to check the system date using PG/SQL ??
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: System Date
@ 2007-01-18 23:31 Benjamin Krajmalnik <kraj@illumen.com>
parent: Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
0 siblings, 1 reply; 5+ messages in thread
From: Benjamin Krajmalnik @ 2007-01-18 23:31 UTC (permalink / raw)
To: Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>; pgsql-admin
select CURRENT_TIMESTAMP
or
select LOCALTIMESTAMP
the first has the information with the timezone offset at the end,
whereas the second does not.
________________________________
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Negandhi, Nishith
Sent: Thursday, January 18, 2007 3:43 PM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] System Date
Hi,
How to check the system date using PG/SQL ??
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: System Date
@ 2007-01-19 00:04 Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
parent: Benjamin Krajmalnik <kraj@illumen.com>
0 siblings, 2 replies; 5+ messages in thread
From: Negandhi, Nishith @ 2007-01-19 00:04 UTC (permalink / raw)
To: Benjamin Krajmalnik <kraj@illumen.com>; pgsql-admin
Hi Thanx..one more help.
I am creating a function that will retuen the current systemdate.
CREATE FUNCTION "CreateDate"() RETURNS date AS
'select now();'
LANGUAGE 'plpgsql';
However, I get the error:
ERROR: syntax error at or near "select" at character 51
Any suggestions .??
Thanks in advance
________________________________
From: Benjamin Krajmalnik [mailto:kraj@illumen.com]
Sent: Thursday, January 18, 2007 5:31 PM
To: Negandhi, Nishith; pgsql-admin@postgresql.org
Subject: RE: [ADMIN] System Date
select CURRENT_TIMESTAMP
or
select LOCALTIMESTAMP
the first has the information with the timezone offset at the end,
whereas the second does not.
________________________________
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org] On Behalf Of Negandhi, Nishith
Sent: Thursday, January 18, 2007 3:43 PM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] System Date
Hi,
How to check the system date using PG/SQL ??
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: System Date
@ 2007-01-19 00:10 Chad Wagner <chad.wagner@gmail.com>
parent: Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
1 sibling, 0 replies; 5+ messages in thread
From: Chad Wagner @ 2007-01-19 00:10 UTC (permalink / raw)
To: Negandhi, Nishith <Nishith.Negandhi@infousa.com>; +Cc: Benjamin Krajmalnik <kraj@illumen.com>; pgsql-admin
On 1/18/07, Negandhi, Nishith <Nishith.Negandhi@infousa.com> wrote:
>
> Hi Thanx..one more help.
> I am creating a function that will retuen the current systemdate.
>
> CREATE FUNCTION "CreateDate"() RETURNS date AS
> 'select now();'
> LANGUAGE 'plpgsql';
>
> However, I get the error:
>
> ERROR: syntax error at or near "select" at character 51
>
> Any suggestions .??
>
> Thanks in advance
>
Syntax is wrong, although I fail to see why you don't just use the "NOW()"
function. I guess I will assume this is just an example. :)
CREATE OR REPLACE FUNCTION "CreateDate"()
RETURNS DATE AS
$$
DECLARE
var_date date;
BEGIN
SELECT NOW()
INTO var_date;
RETURN var_date;
END;
$$ LANGUAGE 'plpgsql';
--
Chad
http://www.postgresqlforums.com/
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: System Date
@ 2007-01-19 08:22 Milen A. Radev <milen@radev.net>
parent: Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
1 sibling, 0 replies; 5+ messages in thread
From: Milen A. Radev @ 2007-01-19 08:22 UTC (permalink / raw)
To: pgsql-admin
Negandhi, Nishith написа:
> Hi Thanx..one more help.
> I am creating a function that will retuen the current systemdate.
>
> CREATE FUNCTION "CreateDate"() RETURNS date AS
> 'select now();'
> LANGUAGE 'plpgsql';
>
> However, I get the error:
>
> ERROR: syntax error at or near "select" at character 51
>
> Any suggestions .??
>
[...]
CREATE FUNCTION "CreateDate"() RETURNS date AS
'select CURRENT_DATE;'
LANGUAGE SQL;
(more info here -
http://www.postgresql.org/docs/current/static/xfunc-sql.html)
Although I fail to see the usefulness of such a function.
--
Milen A. Radev
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2007-01-19 08:22 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-01-18 22:42 System Date Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
2007-01-18 23:31 ` Benjamin Krajmalnik <kraj@illumen.com>
2007-01-19 00:04 ` Negandhi, Nishith <Nishith.Negandhi@infoUSA.com>
2007-01-19 00:10 ` Chad Wagner <chad.wagner@gmail.com>
2007-01-19 08:22 ` Milen A. Radev <milen@radev.net>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox