Re: [SQL] arrays and polygons

2004-02-13 Thread Joe Conway
Tom Lane wrote: "David" <[EMAIL PROTECTED]> writes: INSERT INTO species (location) VALUES ('{((432,89), (45,87), (89,87)), ((54,78), (34,98))}; I think you'd need to double-quote each polygon within the array literal. '{"((432,89), (45,87), (89,87))", "..."}' The array parser doesn't think parens

Re: [SQL] arrays and polygons

2004-02-13 Thread David
Thanks to you both that helped enormously, Dave - Original Message - From: "Joe Conway" <[EMAIL PROTECTED]> To: "Tom Lane" <[EMAIL PROTECTED]> Cc: "David" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 4:33 PM Subject: Re: [SQL] arrays and polygons > Tom Lan

Re: [SQL] 7.4 - FK constraint performance

2004-02-13 Thread Stephan Szabo
On Fri, 13 Feb 2004, Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > On Fri, 13 Feb 2004, Tom Lane wrote: > >> I was looking at that last night. It seems like we could add a LIMIT at > >> least in some contexts. In the case at hand, we're just going to error > >> out immediately

Re: [SQL] 7.4 - FK constraint performance

2004-02-13 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > On Fri, 13 Feb 2004, Tom Lane wrote: >> I was looking at that last night. It seems like we could add a LIMIT at >> least in some contexts. In the case at hand, we're just going to error >> out immediately if we find a matching row, and so there's no nee

Re: [SQL] 7.4 - FK constraint performance

2004-02-13 Thread Stephan Szabo
On Fri, 13 Feb 2004, Tom Lane wrote: > Stephan Szabo <[EMAIL PROTECTED]> writes: > > One thing is that IIRC we're going to ask for only one row when we do the > > SPI_execp_current. However, unless I misremember, the behavior of for > > update and limit means that saying limit 1 is potentially un

Re: [SQL] 7.4 - FK constraint performance

2004-02-13 Thread Tom Lane
Stephan Szabo <[EMAIL PROTECTED]> writes: > One thing is that IIRC we're going to ask for only one row when we do the > SPI_execp_current. However, unless I misremember, the behavior of for > update and limit means that saying limit 1 is potentially unsafe (if you > block on a row that goes away).

Re: [SQL] column alias and group by/having/order

2004-02-13 Thread Tom Lane
Tomasz Myrta <[EMAIL PROTECTED]> writes: > I found some strange column alias behaviour: That's how it is. The fact that you can reference output-column aliases at all in GROUP BY or ORDER BY is a wart, because it conflicts with the logical model of query evaluation --- the output list should be c

Re: [SQL] 7.4 - FK constraint performance

2004-02-13 Thread Stephan Szabo
On Thu, 12 Feb 2004, Tom Lane wrote: > Rod Taylor <[EMAIL PROTECTED]> writes: > > Statistics say there are 10 values. Statistics list the 10 most common > > values (all of them). Given this, would it not be reasonable to assume > > that 239 is a recent addition (if there at all) to the table and n

Re: [SQL] arrays and polygons

2004-02-13 Thread Tom Lane
"David" <[EMAIL PROTECTED]> writes: > ALTER TABLE species ADD COLUMN location polygon[]; > INSERT INTO species (location) VALUES ('{((432,89), (45,87), (89,87)), > ((54,78), (34,98))}; I think you'd need to double-quote each polygon within the array literal. '{"((432,89), (45,87), (89,87

Re: [SQL] column alias and group by/having/order

2004-02-13 Thread Rod Taylor
> select val1+val2 as val > from some_table > group by val having val>1; > ERROR: Attribute "val" not found > > Is it a bug or a feature? It's a mis-feature that group by accepts aliases of the select list. Having is proper. ---(end of broadcast)--

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-13 Thread Tomasz Myrta
Dnia 2004-02-13 10:14, Użytkownik Kumar napisał: Thanks Tomasz Myrta. It is wonderful. I am still amazed from where you guys knowing the options like quote_literal, etc. Kumar Just read the manual ;-) 6.4. String Functions and Operators Tomasz ---(end of broadcast)-

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-13 Thread Kumar
Thanks Tomasz Myrta. It is wonderful. I am still amazed from where you guys knowing the options like quote_literal, etc. Kumar - Original Message - From: "Tomasz Myrta" <[EMAIL PROTECTED]> To: "Kumar" <[EMAIL PROTECTED]> Cc: "psql" <[EMAIL PROTECTED]> Sent: Friday, February 13, 2004 1:37

Re: [SQL] How to avoid nulls while writing string for dynamic query

2004-02-13 Thread Tomasz Myrta
Dnia 2004-02-13 08:13, Użytkownik Kumar napisał: oh, ok understood. What will happen for a timestamp field. Let us say c1 is a timestamp column. sqlstr := 'insert into test(c1, c2) values ('||'\''||COALESCE(rec.c1,'NULL')||'\',' ||'\''||rec.c2||'\')'; If this case the query will be insert