[SQL] transaction in function

2006-12-05 Thread Marian POPESCU
Hi, I want to write a function that updates several tables; if there is an exception while updating, it should rollback the transaction and raise an error. How can this be done in pgPLSQL in PostgreSQL 8.1 ? Thank you for helping me out on this one ! ---(end of broadca

Re: [SQL] transaction in function

2006-12-05 Thread A. Kretschmer
am Tue, dem 05.12.2006, um 16:25:31 +0100 mailte Marian POPESCU folgendes: > Hi, > > I want to write a function that updates several tables; if there is an > exception while updating, it should rollback the transaction and raise an > error. > > How can this be done in pgPLSQL in PostgreSQL 8.1 ?

Re: [SQL] transaction in function

2006-12-05 Thread Tom Lane
Marian POPESCU <[EMAIL PROTECTED]> writes: > I want to write a function that updates several tables; if there is an > exception while updating, it should rollback the transaction and raise an > error. > How can this be done in pgPLSQL in PostgreSQL 8.1 ? You just do it. You would have to work at

[SQL] Question about "AT TIME ZONE"

2006-12-05 Thread Collin Peters
The following is taken from section 9.9.3 of the help docs === Examples (supposing that the local time zone is PST8PDT): SELECT TIMESTAMP '2001-02-16 20:38:40' AT TIME ZONE 'MST'; Result: 2001-02-16 19:38:40-08 SELECT TIMESTAMP WITH TIME ZONE '2001-02-16 2

[SQL] Can someone explain the problem with this select

2006-12-05 Thread Richard Ray
Allow me to demonstrate my pitiful SQL knowledge I have tables documents and comments If I run join and list doc_nums the query is quite fast If I run join and use subselect the query is extremely slow Can someone offer analysis Thanks Richard dcc=# EXPLAIN ANALYZE select doc_num from documents

Re: [SQL] transaction in function

2006-12-05 Thread Din Adrian
Any function runs into a single transaction so you don't need to worry about rolling back on exceptions - this is the standard behavior. If there is an exception while running any statement inside the function it's rolls back automatically. On Tue, 05 Dec 2006 17:25:31 +0200, Marian POPE

Re: [SQL] Question about "AT TIME ZONE"

2006-12-05 Thread Tom Lane
"Collin Peters" <[EMAIL PROTECTED]> writes: > In the first example it says it is converted to PST "for display". In > the second example it is not converted to PST for display. Does this > mean that if a timestamp *with* a timezone is specified, and it also > includes "AT TIME ZONE", that it is n

Re: [SQL] Can someone explain the problem with this select

2006-12-05 Thread Tom Lane
Richard Ray <[EMAIL PROTECTED]> writes: > dcc=# EXPLAIN ANALYZE select * from documents left outer join comments on > (documents.doc_num = comments.doc_num) where documents.doc_num in (select > doc_num from documents limit 10); > [ is slow ] This isn't your fault, it's an optimizer limitation: P

Re: [SQL] Can someone explain the problem with this select

2006-12-05 Thread Richard Broersma Jr
> dcc=# EXPLAIN ANALYZE select * from documents left outer join comments on > (documents.doc_num = comments.doc_num) where documents.doc_num in (select > doc_num from documents limit 10); This query is preforming the join on all records of your two tables. After all of the that exhaustive work

Re: [SQL] Can someone explain the problem with this select

2006-12-05 Thread Richard Ray
I've been foolin with this for a couple of days Sometimes you just have to ask Thanks gentlemen On Tue, 5 Dec 2006, Tom Lane wrote: Richard Ray <[EMAIL PROTECTED]> writes: dcc=# EXPLAIN ANALYZE select * from documents left outer join comments on (documents.doc_num = comments.doc_num) where doc

Re: [SQL] Can someone explain the problem with this select

2006-12-05 Thread Ted Allen
Hey Ray, I'm by no means a guru but here is my simple analysis. In the first query, the 10 "documents" specified 'IN' the in are first selected from the "documents" table. Then, those 10 rows are joined with the "comments" table. In the second query, every row in the "documents" table is j

Re: [SQL] Using Control Flow Functions in a SELECT Statement

2006-12-05 Thread Ragnar
[ removing a bunch of probably uninterested people from CC ] On mán, 2006-12-04 at 22:12 +0530, Ashish Ahlawat wrote: > Hi Team > > Thanks > > FOR your prompt responseBut USING CASE issue still NOT > resolvedOracle prompts same error. this is a postgresql mailing list, but I believe t

[SQL] I don't want receive more emails

2006-12-05 Thread Eliana Gutierrez
hi, could you tell me, what have I do for not reveice more emails thanks ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] I don't want receive more emails

2006-12-05 Thread Richard Broersma Jr
> hi, could you tell me, what have I do for not reveice more emails Send an email to: [EMAIL PROTECTED] Regards, Richard Broersma Jr. ---(end of broadcast)--- TIP 7: You can help support the PostgreSQL project by donating at

Re: [HACKERS] [SQL] Case Preservation disregarding case

2006-12-05 Thread Ken Johanson
Bruce Momjian wrote: Tom Lane wrote: The real bottom line, though, is that this community has little respect for proposals that involve moving away from the SQL spec rather than closer to it; and that's what you're asking us to do. The spec is not at all vague about the case-sensitivity of ide