choiche of function language was: Re: [GENERAL] dynamic procedure call

2008-05-10 Thread Ivan Sergio Borgonovo
On Sat, 10 May 2008 07:35:36 +0200 "Pavel Stehule" <[EMAIL PROTECTED]> wrote: > your application different execution paths. Generally I can say, so > plpgsql isn't well language for this games, and better is using > plperl, plpython or other external language. It is clear what is at least one of

[GENERAL] Returning RECORD from PGSQL without custom type?

2008-05-10 Thread D. Dante Lorenso
Instead of doing this: CREATE OR REPLACE FUNCTION "my_custom_func" (in_value bigint) RETURNS SETOF record AS $body$ ... $body$ LANGUAGE 'plpgsql' VOLATILE; I'd like to be able to do this: CREATE OR REPLACE FUNCTION "my_custom_func" (in_value bigint) RETURNS SETOF (col1name BIGIN

Re: [GENERAL] Extract only numbers from a varchar column

2008-05-10 Thread Gerald Quimpo
On Tuesday 06 May 2008 07:09:56 Leandro Casadei wrote: > I need to extract only the first occurence of numbers from a column that > is varchar. > abc200xx -> 200 > 340ppsdd -> 340 > 150ytyty555 -> 150 tiger=> select substring('abc200xx300ff','[0-9]+'); substring --- 200 (1 row) Time:

Re: choiche of function language was: Re: [GENERAL] dynamic procedure call

2008-05-10 Thread Pavel Stehule
Hello 2008/5/10 Ivan Sergio Borgonovo <[EMAIL PROTECTED]>: > On Sat, 10 May 2008 07:35:36 +0200 > "Pavel Stehule" <[EMAIL PROTECTED]> wrote: > >> your application different execution paths. Generally I can say, so >> plpgsql isn't well language for this games, and better is using >> plperl, plpyth

Re: [GENERAL] Returning RECORD from PGSQL without custom type?

2008-05-10 Thread Pavel Stehule
Hello there exist table returning functions patch, but newer been applied. It's some what you need. Why don't you use OUT variables? try CREATE OR REPLACE FUNCTION fce(IN value int, OUT a int, OUT b int) RETURNS SETOF record AS $$ BEGIN FOR i IN 1..$1 LOOP a := i + 1; b := i + 2; RETU

[GENERAL] Problem returning strings with pgsql 8.3.x

2008-05-10 Thread Josh Tolley
While developing PL/LOLCODE, I've found something wrong with returning strings from LOLCODE functions using 8.3.0 or greater. Using 8.4beta from a few days ago, for instance, a function that should return "test string" returns "\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F\x7F" in pgsql

Re: choiche of function language was: Re: [GENERAL] dynamic procedure call

2008-05-10 Thread Steve Atkins
On May 10, 2008, at 12:14 AM, Ivan Sergio Borgonovo wrote: On Sat, 10 May 2008 07:35:36 +0200 "Pavel Stehule" <[EMAIL PROTECTED]> wrote: your application different execution paths. Generally I can say, so plpgsql isn't well language for this games, and better is using plperl, plpython or othe

Re: choiche of function language was: Re: [GENERAL] dynamic procedure call

2008-05-10 Thread Tom Lane
Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > It is clear what is at least one of the advantage of plpython or > plperl over plpgsql, but then what are the advantages of plpgsql over > the rest of the crowd other than resembling the language used in > Oracle? Others made some other comments

Re: choiche of function language was: Re: [GENERAL] dynamic procedure call

2008-05-10 Thread Tom Lane
I wrote: > We've poked a few loopholes in the strong typing over the years > --- the whole business of EXECUTE versus direct evaluation of a > query can be seen as allowing weak typing for EXECUTE'd queries. > But it's still the language's design center. Rereading that, it suddenly struck me that

Re: [GENERAL] Returning RECORD from PGSQL without custom type?

2008-05-10 Thread Ivan Sergio Borgonovo
On Sat, 10 May 2008 02:36:50 -0500 "D. Dante Lorenso" <[EMAIL PROTECTED]> wrote: > Instead of doing this: > >CREATE OR REPLACE FUNCTION "my_custom_func" (in_value bigint) >RETURNS SETOF record AS >$body$ >... >$body$ >LANGUAGE 'plpgsql' VOLATILE; What's the problem with t

Re: [GENERAL] Using Epoch to save timestamps in 4 bytes?

2008-05-10 Thread Francisco Reyes
Bruce Momjian writes: I am looking at tens of millions of rows, which is why my predecessor may have used integer to store epoch to save space. Our timestamp has a much larger range than a 4-byte time_t, docs say: 4713 BC 294276 AD Given that all of our dates will fall w

Re: [GENERAL] Using Epoch to save timestamps in 4 bytes?

2008-05-10 Thread Tom Lane
Francisco Reyes <[EMAIL PROTECTED]> writes: > Given that all of our dates will fall within what we can store in 4bytes, > what would be the easiest way to use epoch as a timestamp? Well, if you're bound and determined to create a Y2038 problem for yourself, you could use the legacy "abstime" data