Re: [SQL] A transaction in transaction? Possible?

2004-11-09 Thread Michael Fuhr
On Wed, Nov 10, 2004 at 09:23:02AM +0300, sad wrote: > On Tuesday 09 November 2004 18:24, Theodore Petrosky wrote: > > I thought nested transactions are available in the new > > release (8) coming up. > > how to commit/rollback them ? CREATE TABLE person (id SERIAL PRIMARY KEY, name TEXT NOT NULL

Re: [SQL] A transaction in transaction? Possible?

2004-11-09 Thread sad
On Tuesday 09 November 2004 18:24, Theodore Petrosky wrote: > I thought nested transactions are available in the new > release (8) coming up. how to commit/rollback them ? ---(end of broadcast)--- TIP 7: don't forget to increase your free space ma

Re: [SQL] Is NULLIF nullable?

2004-11-09 Thread Dean Gibson (DB Administrator)
You can ignore my question below, since I just put the field definition below in an SQL FUNCTION and marked it STRICT. -- Dean Dean Gibson (DB Administrator) wrote on 2004-11-09 19:29: Recently I asked about why a field from the nullable side of an OUTER JOIN was causing the JOIN to be inefficie

Re: [SQL] UPDATE/INSERT on multiple co-dependent tables

2004-11-09 Thread Stephan Szabo
On Tue, 9 Nov 2004, Ferindo Middleton, Jr wrote: > Is it possible for an UPDATE/INSERT query string to function in such a way > that it requires two like fields in different tables to be equal to/'in sync > with' one another: > > Example: I have two tables: registration & schedules > they both

[SQL] Is NULLIF nullable?

2004-11-09 Thread Dean Gibson (DB Administrator)
Recently I asked about why a field from the nullable side of an OUTER JOIN was causing the JOIN to be inefficient, and was told that it was because that field had a CASE statement as part of its definition, and that CASE (and by extension COALESCE) were non-nullable constructs. Is NULLIF nullab

[SQL] UPDATE/INSERT on multiple co-dependent tables

2004-11-09 Thread Ferindo Middleton, Jr
Is it possible for an UPDATE/INSERT query string to function in such a way that it requires two like fields in different tables to be equal to/'in sync with' one another: Example: I have two tables: registration & schedules they both record a class_id, start_date, end_date... I want to make su

Re: [SQL] Aggregate like AVG() with Money Data Type

2004-11-09 Thread Michael Fuhr
On Tue, Nov 09, 2004 at 06:40:53PM -0200, andre.toscano wrote: > How can I use the aggregate AVG() with a column MONEY? The MONEY type has been deprecated since at least PostgreSQL 7.0. Is there a reason you're not using NUMERIC? -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [SQL] Comparing two (largish) tables on different servers

2004-11-09 Thread Pierre-Frédéric Caillaud
Idea : Write a program which connects on the two databases, creates a cursor on each to return the rows in order, then compare them as they come (row 1 from cursor 1 == row 1 from cursor 2, etc). Fetch in batchs. If there's a difference you can then know which row. I hope you have an index

[SQL] Comparing two (largish) tables on different servers

2004-11-09 Thread Gregory S. Williamson
This is probably a silly question. Our runtime deployment of database servers (7.4) involves some redundant/duplicate databases. In order to compare tables (about 5 gigs each) on different servers I unload the things (takes a while etc.), sort them with a UNIX sort and then do a cksum on them.

[SQL] Aggregate like AVG() with Money Data Type

2004-11-09 Thread andre.toscano
Hello Friends How can I use the aggregate AVG() with a column MONEY? Thanks in Advance André (Brazilian User) __ Acabe com aquelas janelinhas que pulam na sua tela. AntiPop-up UOL - É grátis! http://antipopup.uol.com.br/

Re: [SQL] Drop all indexes of a table w/o knowing the index names

2004-11-09 Thread Giulio Orsero
On Tue, 9 Nov 2004 17:30:25 +0200 (EET), Achilleus Mantzios <[EMAIL PROTECTED]> wrote: >O Giulio Orsero Ýãñáøå óôéò Nov 9, 2004 : >> I need a way to drop all indexes of a table without knowing the names of the >> indexes. >% foreach i ( `psql -t -q -c "SELECT ci.relname from pg_index i,pg_class

Re: [SQL] upper/lower for german characters

2004-11-09 Thread Markus Schaber
Hi, Andrei, On Tue, 9 Nov 2004 16:58:27 +0200 "Andrei Bintintan" <[EMAIL PROTECTED]> wrote: > Hi to all, I have the problem that: > select lower('MöBÜEL') or select upper('MöBÜEL') are not working well. > > I read on some forums that there is some locale setting that needs to > be done here, bu

Re: [SQL] Simple SQL Question

2004-11-09 Thread Franco Bruno Borghesi
Didn't know about the seqscan problem when using ORs. But you still can split the query in two, and then use Union to join the results: SELECT WHERE itemKey=:lastItemKey AND location>:lastLocation UNION SELECT ... WHERE itemKey>:lastItemKey You could solve the OFFSET/LIMIT modification probl

[SQL] Loading text data/binary data !!

2004-11-09 Thread Goutam Paruchuri
Hello all,    2 questions !   Question 1 Iam trying to load binary data from sql server to postges.  Do i have to write a script .. ??   Question 2 How i do load text data with newlines into postgres database .. (as newline is the default row delimiter and cannot be changed in the column

Re: [SQL] A transaction in transaction? Possible?

2004-11-09 Thread Theodore Petrosky
I thought nested transactions are available in the new release (8) coming up. Ted --- Andrei Bintintan <[EMAIL PROTECTED]> wrote: > Is it possible to have another transatction in a > transaction??? In the following example the last > ROLLBACK is totally ignored(transaction1). > > //connect to

Re: [SQL] Drop all indexes of a table w/o knowing the index names

2004-11-09 Thread Achilleus Mantzios
O Giulio Orsero έγραψε στις Nov 9, 2004 : > 7.4.6 on Linux. > > I need a way to drop all indexes of a table without knowing the names of the > indexes. > > Say I have a table > > table1 > index1 > index2 > index3 > > I don't want to do > > drop index1; > drop index2; > drop

[SQL] upper/lower for german characters

2004-11-09 Thread Andrei Bintintan
Hi to all, I have the problem that: select lower('MöBÜEL') or select upper('MöBÜEL') are not working well. I read on some forums that there is some locale setting that needs to be done here, but could not fix this. I am using the ASCII encoding.   Please advice. Thakx.Andy.

[SQL] Drop all indexes of a table w/o knowing the index names

2004-11-09 Thread Giulio Orsero
7.4.6 on Linux. I need a way to drop all indexes of a table without knowing the names of the indexes. Say I have a table table1 index1 index2 index3 I don't want to do drop index1; drop index2; drop index3; but I want drop is this possible? I looked in the manual at

Re: [SQL] tricky GROUP BY / JOIN question

2004-11-09 Thread T E Schmitz
Hello Tom, Tom Lane wrote: T E Schmitz <[EMAIL PROTECTED]> writes: This is *almost* what I need: SELECT BRAND.BRAND_NAME, MODEL.MODEL_NAME, min (ITEM.PRICE),max (ITEM.PRICE) *min (CONDITION.POSITION),max (CONDITION.POSITION)* FROM ITEM left outer join MODEL on MODEL_PK =ITEM.MODEL_FK left outer j

Re: [SQL] A transaction in transaction? Possible?

2004-11-09 Thread Michael Fuhr
On Tue, Nov 09, 2004 at 10:47:06AM +0200, Andrei Bintintan wrote: > Is it possible to have another transatction in a transaction??? PostgreSQL 8.0 (currently in beta) has savepoints, so you'll be able to do this: BEGIN; UPDATE orders SET technikernotiz='51' WHERE id=16143; SAVEPOINT foo; UPDATE

[SQL] INSERT INTO VIEW - Replacement

2004-11-09 Thread marc ratun
Hi, I've this data model: CREATE SEQUENCE a_seq START 1; CREATE SEQUENCE b_seq START 1; CREATE TABLE a ( aid integer NOT NULL PRIMARY KEY, aval character varying (255) NOT NULL ); INSERT INTO a (select nextval('a_seq'),'a1'); INSERT INTO a (select nextval('a_seq'),'a2'); CREATE TABLE b ( b

Re: [SQL] Simple SQL Question

2004-11-09 Thread Andras Kutrovics
Franco Bruno Borghesi wrote: Hi! Sorry for being late with the answer, I was busy at one of our customer;) wouldn't it be easier using offset & limit?: you always select from the table with an itemkey,location order by clause. You save the current offset between requests, and for every request yo

[SQL] A transaction in transaction? Possible?

2004-11-09 Thread Andrei Bintintan
Is it possible to have another transatction in a transaction??? In the following example the last ROLLBACK is totally ignored(transaction1). //connect to database$database = dbConnect($dbhost, $dbuser, $dbpass, $dbname);dbExec($database, "BEGIN"); //transaction1//*        dbExec($databa