RE: [SQL] Create table in functions

2000-08-23 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane > > "Hiroshi Inoue" <[EMAIL PROTECTED]> writes: > > Hmm,Andreas's original function seems to contain other statements. > > If the function contains DML statements for the table Temp_Num_Table, > > it wouldn't work properly. i.e 1st call would work but

Re: [SQL] Create table in functions

2000-08-23 Thread Tom Lane
"Hiroshi Inoue" <[EMAIL PROTECTED]> writes: > Hmm,Andreas's original function seems to contain other statements. > If the function contains DML statements for the table Temp_Num_Table, > it wouldn't work properly. i.e 1st call would work but 2nd call woudn't. Are you thinking about plpgsql's cach

RE: [SQL] Create table in functions

2000-08-23 Thread Hiroshi Inoue
> -Original Message- > From: Tom Lane > > Andreas Tille <[EMAIL PROTECTED]> writes: > > web=# create function pHelpTable( ) > > web-# returns int > > web-# As ' > > web'# Begin > > web'# Create Table Temp_NumTable ( Num int ) ; > > web'# > > web'# return 17 ; > > we

[SQL] Re: Speed or configuration

2000-08-23 Thread Franz J Fortuny
Any light on this subject?   The Hermit Hacker wrote:"use cut-n-paste please, and send us the results of theEXPLAIN ... stufflike the cost estimates and whatnot tell us *so* much..."This is it:exis=# \d pvdprcod NUMART    | integer | not null NUMDEP    | smallint    | not null NUMPRO   

[SQL] db benchmarks

2000-08-23 Thread drfrog
does anyone have links to independent benchmarks just mysql vs postgresql would be cool the last one that came out was from Great Bridge has been contested by many {including mysql} i was wondering if anyone here does have independent benchmarks id sure appreciate

Re: [SQL] Create table in functions

2000-08-23 Thread Jie Liang
Hi, there, I don't think that you can use DDL in PL/pgSQL, normally say , you can only use DML in PL/pgSQL. i.e. you can use select into,update,delete,insert ... , but you cannot use create, alter, grant ... Andreas Tille wrote: > Hello, > > I striped down my function up to a strange thing: >

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Jan Wieck
Tom Lane wrote: > Jan Wieck <[EMAIL PROTECTED]> writes: > > hlefebvre wrote: > >> I'd like to return a set of integer in an pl/pgsql function. How can I > >> do that ? > > > You can't. Not with PL/pgSQL nor with any other PL or C. The > > problem is nested deeper and requires the planned

Re: [SQL] Create table in functions

2000-08-23 Thread Tom Lane
Andreas Tille <[EMAIL PROTECTED]> writes: > web=# create function pHelpTable( ) > web-# returns int > web-# As ' > web'# Begin > web'# Create Table Temp_NumTable ( Num int ) ; > web'# > web'# return 17 ; > web'# End; ' > web-# language 'plpgsql' ; > CREATE The majori

[SQL] Create table in functions

2000-08-23 Thread Andreas Tille
Hello, I striped down my function up to a strange thing: web=# create function pHelpTable( ) web-# returns int web-# As ' web'# Begin web'# Create Table Temp_NumTable ( Num int ) ; web'# web'# return 17 ; web'# End; ' web-# language 'plpgsql' ; CREATE web=# web=# s

Re: [SQL] Copy To - fixed width

2000-08-23 Thread Adam Lang
Sort of nevermind, can I can save it tab delimited, but I am still curious if it can be done using fixed width fields. Adam Lang Systems Engineer Rutgers Casualty Insurance Company - Original Message - From: "Adam Lang" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, August

[SQL] Copy To - fixed width

2000-08-23 Thread Adam Lang
Is it possible to copy from a text file that has the fields as fixed width with no delimiter to a table? The other option is a CSV file... but then how do I handle if there is a comma in one of the fields? I'm transfering information from an AS/400 ... if it is into a text file, it is fixed widt

Re: [SQL] Re: Date of creation and of change

2000-08-23 Thread Tom Lane
Andreas Tille <[EMAIL PROTECTED]> writes: > On Wed, 23 Aug 2000, hlefebvre wrote: >> create table mytable( CreateDate timestamp default timestamp('now'), >> ); > I've done a pg_dump and there this line was transformed to: > "createdat" timestamp DEFAULT '23.08.2000 15:35:16.00 CEST'::"t

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Tom Lane
Jan Wieck <[EMAIL PROTECTED]> writes: > hlefebvre wrote: >> I'd like to return a set of integer in an pl/pgsql function. How can I >> do that ? > You can't. Not with PL/pgSQL nor with any other PL or C. The > problem is nested deeper and requires the planned querytree > redesign to

Re: [SQL] Re: Date of creation and of change

2000-08-23 Thread hlefebvre
Andreas Tille wrote: > I tried: > > web=# CREATE FUNCTION changed_at_timestamp () RETURNS OPAQUE AS ' > web'# BEGIN > web'# ChangeDate := timestamp(''now''); > web'# RETURN NEW; > web'# END; > web'# ' LANGUAGE 'plpgsql'; > CREATE > web=# select changed_at_timestamp () ;

Re: [SQL] Null function parameters

2000-08-23 Thread Tom Lane
[EMAIL PROTECTED] (Anatoly K. Lasareff) writes: > I'afraid no. My question is: if I pass one null argument into function > then all other argumens, which are not null, became null inside > function body. Yes --- and not only that, but the function's result will be taken to be null whether you wan

[SQL] Re: Date of creation and of change

2000-08-23 Thread Andreas Tille
On Wed, 23 Aug 2000, hlefebvre wrote: > create table mytable( CreateDate timestamp default timestamp('now'), > ); I've done a pg_dump and there this line was transformed to: "createdat" timestamp DEFAULT '23.08.2000 15:35:16.00 CEST'::"timestamp", I'm afraid if I ever should use this

[SQL] Re: Date of creation and of change

2000-08-23 Thread Andreas Tille
On Wed, 23 Aug 2000, hlefebvre wrote: > create table mytable( CreateDate timestamp default timestamp('now'), > ); Thanks, this works. > CREATE FUNCTION myt_stamp () RETURNS OPAQUE AS > BEGIN > ChangeDate := timestamp(''now''); > RETURN NEW; > END; > ' LANGUAGE 'pl

[SQL] Re: Using SETOF in plpgsql function

2000-08-23 Thread Andreas Tille
On Wed, 23 Aug 2000, Jan Wieck wrote: > You can't. Not with PL/pgSQL nor with any other PL or C. The > problem is nested deeper and requires the planned querytree > redesign to get solved. > > Before you ask: The mentioned redesign will NOT be done for > 7.1, and I'm not

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Karel Zak
On Wed, 23 Aug 2000, Jan Wieck wrote: > Before you ask: The mentioned redesign will NOT be done for > 7.1, and I'm not sure if we will be able to do it for 7.2 > yet. I hope that 7.2 :-), my query/plan cache is still outside current interest and if core developers not will wo

Re: [SQL] Null function parameters

2000-08-23 Thread Anatoly K. Lasareff
> "GV" == Graham Vickrage <[EMAIL PROTECTED]> writes: GV> Thanks Anatoly GV> So if I understand you correctly you can't pass more than one NULL int into GV> a function? I'afraid no. My question is: if I pass one null argument into function then all other argumens, which are not null, beca

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Jan Wieck
hlefebvre wrote: > Hello, > > I'd like to return a set of integer in an pl/pgsql function. How can I > do that ? You can't. Not with PL/pgSQL nor with any other PL or C. The problem is nested deeper and requires the planned querytree redesign to get solved. Before you ask: T

RE: [SQL] Null function parameters

2000-08-23 Thread Graham Vickrage
Thanks Anatoly So if I understand you correctly you can't pass more than one NULL int into a function? Therefore Newbe DBA type question: - Is this a shortcoming in postgres or is it to be expected when dealing with transactions? If it is a shotcoming are there any plans to include it in future

Re: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread hlefebvre
Graham Vickrage wrote: > > As far as i know, you can only return single values from functions at the > moment. > > Regards > > Graham Hum, this is possible a least in SQL functions. But maybe impossible in PL/PGSQL

RE: [SQL] Using SETOF in plpgsql function

2000-08-23 Thread Graham Vickrage
As far as i know, you can only return single values from functions at the moment. Regards Graham -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of hlefebvre Sent: 23 August 2000 11:08 To: [EMAIL PROTECTED] Subject: [SQL] Using SETOF in plpgsql function

Re: [SQL] Null function parameters

2000-08-23 Thread Anatoly K. Lasareff
> "TL" == Tom Lane <[EMAIL PROTECTED]> writes: TL> "Graham Vickrage" <[EMAIL PROTECTED]> writes: >> However my understanding was that if the default value is SQL NULL then any >> values passed into the function that are null would be treated as 'NULL'. TL> Not sure what you think you mea

Re: [SQL] Date of creation and of change

2000-08-23 Thread hlefebvre
Andreas Tille wrote: > > Hello, > > could someone enlighten a fairly beginner how to define columns > of a table with the following features: > >CreateDate DEFAULT value should store current date and time create table mytable( CreateDate timestamp default timestamp('now'), ); >

[SQL] Date of creation and of change

2000-08-23 Thread Andreas Tille
Hello, could someone enlighten a fairly beginner how to define columns of a table with the following features: CreateDate DEFAULT value should store current date and time ChangeDate DEFAULT value at creation as above and a Trigger function which stores data end time of any ch

[SQL] Using SETOF in plpgsql function

2000-08-23 Thread hlefebvre
Hello, I'd like to return a set of integer in an pl/pgsql function. How can I do that ? I've tried things like that, put I've an error when executing : CREATE FUNCTION SP_UPLES() RETURNS setof INTEGER AS ' DECLARE ID INTEGER; BEGIN select a into id from foo; return ID ; END;

Re: [SQL] Continuous inserts...

2000-08-23 Thread Joerg Hessdoerfer
Hi! At 14:16 22.08.00 -0400, you wrote: >Jan Wieck <[EMAIL PROTECTED]> writes: > > I haven't looked at the code, but pg_class only has a boolean > > telling if a class has rules or not. Could it be that adding > > more rules (or dropping just a few instead of all) doesn't > >