Unix Technical Forum

Re: plpgsql-function with timestamp

This is a discussion on Re: plpgsql-function with timestamp within the pgsql Novice forums, part of the PostgreSQL category; --> Christian Stalp <christian.stalp@gmx.de> schrieb: [ problem ] Which version? test=# create table foo (ts timestamp); CREATE TABLE test=# insert ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Novice

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-17-2008, 10:36 PM
Andreas Kretschmer
 
Posts: n/a
Default Re: plpgsql-function with timestamp

Christian Stalp <christian.stalp@gmx.de> schrieb:
[ problem ]

Which version?

test=# create table foo (ts timestamp);
CREATE TABLE
test=# insert into foo values ('1999-01-08 04:05:06');
INSERT 0 1
test=# CREATE OR REPLACE FUNCTION neue_auktion (TIMESTAMP) returns text
AS $$ DECLARE my_startzeit ALIAS FOR $1; BEGIN INSERT INTO foo (ts)
VALUES ( my_startzeit); RETURN 'OK'; END; $$ LANGUAGE plpgsql;
CREATE FUNCTION
test=# SELECT neue_auktion ('1999-01-08 04:05:06');
neue_auktion
--------------
OK
(1 row)

test=# select version();
version
--------------------------------------------------------------------------------------------------------------
PostgreSQL 8.1.2 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.0.3 20060104 (prerelease) (Debian 4.0.2-6)
(1 row)


Btw.: we have a german mailinglist ;-)


HTH, Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect. (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly." (unknow)
Kaufbach, Saxony, Germany, Europe. N 51.05082°, E 13.56889°

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-17-2008, 10:37 PM
Christian Stalp
 
Posts: n/a
Default Re: plpgsql-function with timestamp

The problem is solfed:
I called the function with this arguments:

SELECT neue_auktion ( 1::numeric, 'robot'::text, 'robot'::text, '1999-01-08
04:05:06'::timestamp, '1999-01-08 04:05:06'::timestamp, 10::numeric,
10::numeric, 1::numeric);

And this works.

Thank you...

Gruss Christian

--
DSL-Aktion wegen großer Nachfrage bis 28.2.2006 verlängert:
GMX DSL-Flatrate 1 Jahr kostenlos* http://www.gmx.net/de/go/dsl

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-17-2008, 10:37 PM
Richard Kut
 
Posts: n/a
Default Re: plpgsql-function with timestamp

Hello!

Does the :: do a data type conversion?

On Wednesday 22 February 2006 13:22, Christian Stalp wrote:
> The problem is solfed:
> I called the function with this arguments:
>
> SELECT neue_auktion ( 1::numeric, 'robot'::text, 'robot'::text, '1999-01-08
> 04:05:06'::timestamp, '1999-01-08 04:05:06'::timestamp, 10::numeric,
> 10::numeric, 1::numeric);
>
> And this works.
>
> Thank you...
>
> Gruss Christian


--
Regards,

Richard Kut
Database Administrator
Research & Development
Intelerad Medical Systems Inc.
460 Ste-Catherine West, Suite 210
Montreal, Quebec, Canada H3B 1A7
Tel: 514.931.6222 x7733
Fax: 514.931.4653
rkut@intelerad.com
www.intelerad.com

This email or any attachments may contain confidential or legally
privileged information intended for the sole use of the addressees. Any
use, redistribution, disclosure, or reproduction of this information,
except as intended, is prohibited. If you received this
email in error, please notify the sender and remove all copies of the
message, including any attachments.

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-17-2008, 10:37 PM
Christian Stalp
 
Posts: n/a
Default Re: plpgsql-function with timestamp


> Hello!
>
> Does the :: do a data type conversion?
>

Yes, that right. It seemes to be the only way to tell the function, that
this is the right type?!?

Gruss Christian

--
Telefonieren Sie schon oder sparen Sie noch?
NEU: GMX Phone_Flat http://www.gmx.net/de/go/telefonie

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:13 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com