[SQL] checking for the existence of a current_setting ?

2011-05-03 Thread Marc Mamin
Hello, (Postgres 8.3) I'm misusing the current settings at some places to store session variables. The next function retrieve such a variable, or initialized it with a default value. It is working as expected but performances are slow due to the exception block. Is there a way to m

Re: [SQL] BINARY and BINARY VARYING datatypes in PostgreSQL

2011-05-03 Thread Susanne Ebrecht
On 02.05.2011 12:46, Grzegorz Szpetkowski wrote: I know that BIT and BIT VARYING types were deleted from SQL:2003 and there are "old new" BINARY, BINARY VARYING in SQL:2008. I have two question: 1) Are these types technically the same (I mean implementation things) ? 2) Is PostgreSQL aim to supp

Re: [SQL] PLpgSQL variables persistance between several functions calls

2011-05-03 Thread Willy-Bas Loos
Hi, Maybe calling a function from within another function would be a solution to you. Cheers, WBL On Tue, May 3, 2011 at 4:10 AM, Pavel Stehule wrote: > Hello > > no, it's not possible > > Regards > > Pavel Stehule > > 2011/5/2 Charles N. Charotti : > > Hello everybody ! > > > > I want to know

Re: [SQL] PLpgSQL variables persistance between several functions calls

2011-05-03 Thread Viktor Bojović
the best way is to put all calls into one function and store values to variables.. if that is not suitable you can try the way (which im not sure if anyone uses) and it is to store values to sequences if value type is integer. for other formats you will have to do conversions. but im not sure if s

Re: [SQL] BINARY and BINARY VARYING datatypes in PostgreSQL

2011-05-03 Thread Grzegorz Szpetkowski
Thank you for comprehensive answer. You are right, it is better to implement what users really need in their work, but I believe that people who writing SQL Standard want to give it pragmatic and usable. Regards, Grzegorz Szpetkowski 2011/5/3 Susanne Ebrecht : > On 02.05.2011 12:46, Grzegorz Szp

Re: [SQL] How to realize ROW_NUMBER() in 8.3?

2011-05-03 Thread Emi Lu
Thank you for the info. I found a simple way: == [1] create SEQUENCE tmp start 7820; [2] insert into desti_table_name select nextval('tmp'), c1, c2... ... cN from t1 left join t2... ... tn where ... ... Just for people using 8.3, this is mimic r

Re: [SQL] convert in GMT time zone without summer time

2011-05-03 Thread LaraK
Very good! Another question: I want to convert the string to the type TIMESTAMP WITH TIME ZONE. What do I have to format? 'TZ' does not. select to_timestamp('2011-03-22 14:17:00 Europe/Berlin', '-MM-DD HH:MI:SS TZ') --- FEHLER: Formatmuster »TZ«/»tz« werden in to_date nicht unterstützt -

Re: [SQL] convert in GMT time zone without summer time

2011-05-03 Thread Steve Crawford
On 05/03/2011 12:15 AM, LaraK wrote: Very good! Another question: I want to convert the string to the type TIMESTAMP WITH TIME ZONE. What do I have to format? 'TZ' does not. select to_timestamp('2011-03-22 14:17:00 Europe/Berlin', '-MM-DD HH:MI:SS TZ') Just cast it to a timestamp with

[SQL] function timeout

2011-05-03 Thread Viktor Bojović
im writting plsh function which will execute some shell commands and return result as varchar to database. problem is that some commands will possibly cause to large timeout or will never stop so i wanted to ask if somehow function can be autokilled if it doesn't finish in time defined for that fu

Re: [SQL] How to realize ROW_NUMBER() in 8.3?

2011-05-03 Thread Andreas Kretschmer
Emi Lu wrote: > Thank you for the info. > > I found a simple way: > == > [1] create SEQUENCE tmp start 7820; > [2] > insert into desti_table_name > select nextval('tmp'), >c1, c2... ... cN > from t1 left join t2... ... tn > where ... ... > > Jus