From: | Klint Gore <kg(at)kgb(dot)une(dot)edu(dot)au> |
---|---|
To: | "Harvey, Allan AC" <HarveyA(at)OneSteel(dot)com> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Is this possible. |
Date: | 2006-03-30 01:41:50 |
Message-ID: | 442B375E277.6A3AKG@129.180.47.120 |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Thu, 30 Mar 2006 10:45:20 +1100, "Harvey, Allan AC" <HarveyA(at)OneSteel(dot)com> wrote:
> Hi all,
>
> Can sombody please help me realise a function, the intent as described by...
>
> -- Function to create the table for a new point
>
> CREATE OR REPLACE FUNCTION make_table( varchar ) RETURNS VARCHAR AS '
> CREATE TABLE $1(
> parameter varchar(8) NOT NULL,
> value float NOT NULL,
> dt timestamp NOT NULL
> );
execute ''create table ''||quote_ident($1)||'' (...)'';
> CREATE INDEX $1_dtindex ON $1( dt );
execute ''create index ''||quote_ident($1)||''_dtindex ...'';
> SELECT $1;
return $1;
> ' LANGUAGE SQL;
' language plpgsql;
quote_ident function should help with sql insertion attack.
klint.
+---------------------------------------+-----------------+
: Klint Gore : "Non rhyming :
: EMail : kg(at)kgb(dot)une(dot)edu(dot)au : slang - the :
: Snail : A.B.R.I. : possibilities :
: Mail University of New England : are useless" :
: Armidale NSW 2351 Australia : L.J.J. :
: Fax : +61 2 6772 5376 : :
+---------------------------------------+-----------------+
From | Date | Subject | |
---|---|---|---|
Next Message | raj | 2006-03-30 01:59:57 | Re: checking data type |
Previous Message | Reid Thompson | 2006-03-30 01:18:32 | Re: Implementation Suggestions |