[SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Kenneth Marshall
I am trying to write a function that updates the date column to the current date. According to: http://www.postgresql.org/docs/8.4/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT you can use CURRENT_DATE. When I try to use it in the following pl/pgSQL function it gives the error: ERROR

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Richard Broersma
On Tue, May 18, 2010 at 12:08 PM, Kenneth Marshall wrote: > http://www.postgresql.org/docs/8.4/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT > > you can use CURRENT_DATE. When I try to use it in > the following pl/pgSQL function it gives the error: > BEGIN >    curtime := 'CURRENT_DA

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Pavel Stehule
2010/5/18 Richard Broersma : > On Tue, May 18, 2010 at 12:08 PM, Kenneth Marshall wrote: > >> http://www.postgresql.org/docs/8.4/static/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT >> >> you can use CURRENT_DATE. When I try to use it in >> the following pl/pgSQL function it gives the error:

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Kenneth Marshall
To follow-up, It works using 'now' and I assume that since curtime is of type DATE that the assignment casts the return automatically to type DATE. Thank you for the ideas. Regards, Ken On Tue, May 18, 2010 at 12:12:46PM -0700, Richard Broersma wrote: > On Tue, May 18, 2010 at 12:08 PM, Kenneth

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Kenneth Marshall
Okay, this works as well. Thank you for all of the assistance. Regards, Ken On Tue, May 18, 2010 at 09:25:00PM +0200, Pavel Stehule wrote: > 2010/5/18 Richard Broersma : > > On Tue, May 18, 2010 at 12:08 PM, Kenneth Marshall wrote: > > > >> http://www.postgresql.org/docs/8.4/static/functions-dat

[SQL] plperlu user function.

2010-05-18 Thread David Harel
Greetings, I am trying to write a user function on the server to retrive image files. Currently I wrote the following: CREATE OR REPLACE FUNCTION perl_getfile(text) RETURNS OID AS $BODY$ my $tmpfile = shift; open my $IFHAND, '<', $tmpfile or elog(ERROR, qq{could not open the f

Re: [SQL] plperlu user function.

2010-05-18 Thread Alex Hunsaker
On Tue, May 18, 2010 at 15:29, David Harel wrote: > Greetings, > > I am trying to write a user function on the server to retrive image files. > Currently I wrote the following: > CREATE OR REPLACE FUNCTION perl_getfile(text) >   RETURNS OID AS I think you meant returns bytea or text or something.

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Tim Landscheidt
Kenneth Marshall wrote: > It works using 'now' and I assume that since curtime is > of type DATE that the assignment casts the return automatically > to type DATE. Thank you for the ideas. > [...] What's wrong with Pavel's correct and to-the-point answer? Tim -- Sent via pgsql-sql mailing li

Re: [SQL] How to get CURRENT_DATE in a pl/pgSQL function

2010-05-18 Thread Brian Modra
On 19/05/2010, Tim Landscheidt wrote: > Kenneth Marshall wrote: > >> It works using 'now' and I assume that since curtime is >> of type DATE that the assignment casts the return automatically >> to type DATE. Thank you for the ideas. >> [...] > > What's wrong with Pavel's correct and to-the-point

Re: [SQL] plperlu user function.

2010-05-18 Thread silly sad
On 05/19/10 01:29, David Harel wrote: I am trying to write a user function on the server to retrive image files. Currently I wrote the following: my $tmpfile = shift; open my $IFHAND, '<', $tmpfile Any recommendation how to do it right? first of all, stop opening files at all, return to