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

Re: composite type and assignment in plpgsql

From: Ivan Sergio Borgonovo <mail(at)webthatworks(dot)it>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: composite type and assignment in plpgsql
Date: 2004-04-27 18:27:51
Message-ID: 20040427202751.573a1b3d@stige.webthatworks.it (view raw or flat)
Thread:
Lists: pgsql-general
On Tue, 27 Apr 2004 10:12:13 -0700
Ron St-Pierre <rstpierre(at)syscor(dot)com> wrote:

> Ivan Sergio Borgonovo wrote:

> >	--HERE!!!
> >	thisSession := ( ''t'', md5( now( ) || rand( ) ) );
> >
> - md5 takes TEXT as an argument, not a numeric type

Since it works you surely fixed my code but this should't be an issue
since I tried

test1=# select md5( now( ) || random( ) );
               md5
----------------------------------
 154e804967451148bba5f28e044be828
(1 row)

and

test1=# select md5( random( ) );
               md5
----------------------------------
 31313f537b69d5ffe61be024a40b807e
(1 row)

and they worked.

and yeah I messed up remembering mySQL code and wrote rand( ) inspite
of random( )

Can't user composite type be initialized in a shortest way?
eg. ( ( ), ( ), , ( ), , , ( ), ...)
I thought they could. I saw a similar syntax somewhere in the docs. Am
I daydreaming?

One more thing about the first example presented in this page:
http://www.postgresql.org/docs/7.4/static/plpgsql-expressions.html

I just tried
create or replace function GetSessionID( integer )
	returns tSession as '
declare
	thisSession tSession;
begin
	thisSession.ty_Found := ''t'';
	thisSession.ty_Session := now( );
	return thisSession;
end;
' language plpgsql;

and it returns execution time not "plan" time. Does "plan" time is
strictly referred to SQL statements?


thanks for your help


In response to

Responses

pgsql-general by date

Next:From: Guy FraserDate: 2004-04-27 18:36:16
Subject: Re: BLOB help needed...
Previous:From: Frank FinnerDate: 2004-04-27 18:14:48
Subject: Re: Installation Postgresql

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