Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Achilleus Mantzios
O Joe Conway έγραψε στις May 23, 2005 : > Markus Bertheau wrote: > > why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of > > ARRAY[] resp. '{}'? > > > > Why would you expect an empty array instead of a NULL? NULL is what > you'd get for other data types -- for example: One could

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Markus Bertheau
Dnia 24-05-2005, wto o godzinie 00:06 -0400, Tom Lane napisał(a): > Joe Conway <[EMAIL PROTECTED]> writes: > > Markus Bertheau wrote: > >> why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of > >> ARRAY[] resp. '{}'? > > > Why would you expect an empty array instead of a NULL? > > I

[SQL] Help: Function for splitting VARCHAR column and migrating its data to 2 new tables

2005-05-23 Thread ogjunk-pgjedan
I am restructuring my DB schema and need help migrating data from 1 column of an existing table to two new tables. I have some Java code that can do this for me, but it's very slow, and I am now hoping I can migrate this data with some clever SQL instead. Here are my 3 tables: user_data (existin

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Tom Lane
Joe Conway <[EMAIL PROTECTED]> writes: > Markus Bertheau wrote: >> why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of >> ARRAY[] resp. '{}'? > Why would you expect an empty array instead of a NULL? I think he's got a good point, actually. We document the ARRAY-with- parens-around

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Joe Conway
Markus Bertheau wrote: why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of ARRAY[] resp. '{}'? Why would you expect an empty array instead of a NULL? NULL is what you'd get for other data types -- for example: regression=# SELECT (SELECT 1 WHERE FALSE) IS NULL; ?column?

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Markus Bertheau
Dnia 23-05-2005, pon o godzinie 18:54 +, Jan B. napisał(a): > Perhaps Arrays always have to contain at least one element? (I don't > know for sure.) They can: template1=# select '{}'::TEXT[]; text -- {} (1 запись) I don't know, why the ARRAY[] syntax doesn't work for empty arrays. M

Re: [SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Jan B.
Markus Bertheau wrote: Hi, why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of ARRAY[] resp. '{}'? Markus Perhaps Arrays always have to contain at least one element? (I don't know for sure.) SELECT array[]; ERROR: syntax error at or near "]" at character 14 LINE 1: SELECT

[SQL] ARRAY() returning NULL instead of ARRAY[] resp. {}

2005-05-23 Thread Markus Bertheau
Hi, why does SELECT ARRAY(SELECT 1 WHERE FALSE) return NULL instead of ARRAY[] resp. '{}'? Markus -- Markus Bertheau <[EMAIL PROTECTED]> signature.asc Description: This is a digitally signed message part

Re: [despammed] Re: [SQL] Need clarification

2005-05-23 Thread Andreas Kretschmer
am 23.05.2005, um 16:31:55 +0530 mailte [EMAIL PROTECTED] folgendes: > > > > > Sorry, I didn't get ur point...please, tell me exact query to extract the > rows from a table A which contains a date field named DTE whose difference > is 30 days as compared to the current date... test=# create

Re: [SQL] Need clarification

2005-05-23 Thread palanivel . kumaran
Sorry, I didn't get ur point...please, tell me exact query to extract the rows from a table A which contains a date field named DTE whose difference is 30 days as compared to the current date... Thanks & Regards Palanivel P.K

Re: [despammed] [SQL] need date clarification

2005-05-23 Thread Andreas Kretschmer
am 23.05.2005, um 16:26:23 +0530 mailte [EMAIL PROTECTED] folgendes: > > > > > > how can i extract the system date in postgress. versand=# select now(); now --- 2005-05-23 13:26:13.353826+02 (1 Zeile) versand=# select CURRENT_DATE; date ---

[SQL] need date clarification

2005-05-23 Thread palanivel . kumaran
how can i extract the system date in postgress. Thanks & Regards Palanivel P.K Important Email Information :- The information in this email is confidential and may be legally privileged. It is intended solely for the addressee. Access to this email by anyone else is unauthori

Re: [SQL] Need clarification

2005-05-23 Thread KÖPFERL Robert
Your're looking for the interval data type. timestamp - timestamp or date - date can be compared with interval CURRENT_TIMESTAMP - '4d'::interval => today - 4 days |-Original Message- |From: [EMAIL PROTECTED] |[mailto:[EMAIL PROTECTED] |Sent: Montag, 23. Mai 2005 11:52 |To: pgsql-sql@p

Re: [SQL] Need clarification

2005-05-23 Thread Achilleus Mantzios
O [EMAIL PROTECTED] έγραψε στις May 23, 2005 : > > > > > how can retrieve rows where the datedifference is more than 30... more than 30 in what units? years,days,milliseconds?? > assume there exists a field named 'datacreated' which is of type 'date'. I > need to compare it with the current

[SQL] Need clarification

2005-05-23 Thread palanivel . kumaran
how can retrieve rows where the datedifference is more than 30... assume there exists a field named 'datacreated' which is of type 'date'. I need to compare it with the current date and need to extract the matched rows thanks in advance. Palanivel Important Email Information :- The info

Re: [SQL] Calling Functions in RULEs

2005-05-23 Thread KÖPFERL Robert
Hi, I had no try wheter this solves your problem, but have you conciddered using an array or a self-written fcn which dicards your results i.E. SELECT my_discard_but_last( q1(), q2(), q3()); or SELECT ARRAY[ q1(), q2(), q3() ]; or SELECT ROW(q1(), q2(), q3()) as my_tripel_type; Have you consi