[SQL] Logical comparison on Strings

2004-04-26 Thread kumar
Dear Friends,   Postgres 7.3.2 on Linux 7.   I want to compare to columns and get the logical result as follows.   C1 is 'YNYNY' . C2 is 'NNYYY'.   I want to compare like AND and OR operators.   C1 AND C2 should give result like NNYNY. C1 OR C2 should give result like YNYYY.   Please shed

Re: [SQL] problem with slow select

2004-04-26 Thread Rod Taylor
On Wed, 2004-04-21 at 11:00, francescosaf wrote: > hi > > I have two tables: Please send results of EXPLAIN ANALYZE for the query in question. Thanks ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate

[SQL] problem with slow select

2004-04-26 Thread francescosaf
hi I have two tables: table: idcode varchar(15) -->references (idcode) table latitude float longitude float time timestamp p_a char(1) barcode address idprog serial... -->primary key flag boolean table idfact numeric(7,0) --->references . idcode varchar(15) --->pr

[SQL] Proper SQL syntax requested

2004-04-26 Thread Blake
Wondering if anyone can help me with the proper syntax for an ORDER BY clause with a subquery. What I have is a table column named make in one table. The make column contains a Serial ID of the name which is stored in an alternate table named sections. I am trying to be able to ORDER by on make, bu

[SQL] Trigger calling a function HELP ME! (2)

2004-04-26 Thread Riccardo Facchini
Sorry. I realize I slipped an error in my code: the code is: --- CREATE TABLE public.imp_test ( id int8, value text ) WITHOUT OIDS; CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test) RETURNS imp_test AS 'begin return $1; end;' LANGUAGE 'plpgsql' STABLE; CREAT

[SQL] Which SQL command creates ExclusiveLock?

2004-04-26 Thread Denis Khabas
Hi everyone!   I have a web application that uses Postgresql on backend. The application performs selects, updates, inserts, and deletes by using Hibernate. Tables contain indexed fields. When I run the following query, SELECT * FROM pg_locks, it shows that some transactions place Exclusive

Re: [SQL] Join issue on a maximum value

2004-04-26 Thread Jeremy Semeiks
On Wed, Apr 21, 2004 at 02:29:34PM -0400, Heflin wrote: > OK, it's been a while since I've had to do anything remotely complex in > SQL, so this may just be a pure brain block on my part. > ... > > So a basic JOIN gets this: > > SELECT auction.auction_id, image.image_id, image.image_descr > FROM

[SQL] Cascade delete question

2004-04-26 Thread Glenn MacGregor
Hi All, I am using a cascade delete on the following table: vidvnameparentname 1 [EMAIL PROTECTED] 2 [EMAIL PROTECTED] [EMAIL PROTECTED] 3 [EMAIL PROTECTED] [EMAIL PROTECTED] 4 [EMAIL PROTECTED] [EMAIL PROTECTED] 5 [EMAIL PROTECTED] [E

Re: [SQL] Can someone tell me why this statement is failing?

2004-04-26 Thread denis
Hi.. Your END_TIME_MINUTES condition fails.. 1082377320 <= 1082375100 HTH. Denis - Original Message - From: P A <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, April 20, 2004 2:01 AM Subject: [SQL] Can someone tell me why this statement is failing?

Re: [SQL] Order by YYYY MM DD in reverse chrono order trouble

2004-04-26 Thread denis
Hi, If you want to SORT descending considering multiple column, you need to spefify DESC after each column. Default is ASC. So, your present sorting is ASC, ASC and DESC You can specify 1 DESC, 2 DESC, 3 DESC HTH Denis - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTE

Re: [SQL] Syntax for cmd to EXEC...how many quotes?

2004-04-26 Thread denis
Try (to solve string terminating error ): sql_string := ''INSERT INTO temp_table ( view_name, row_count ) SELECT '' || r_rec.viewname || '', count(*) FROM '' || r_rec.viewname || '' ; '' ; BUT, you will be needing to put view_name in Quote too... try it yourself... HTH Denis - Origin

Re: [SQL] transaction

2004-04-26 Thread denis
Hi, You can achieve this by: 1. Create a new table 2. Insert the data in this. 3. Write a trigger on this table 4. In trigger issue UPDATE and check whether it updated any records. If NO, fire INSERT. ( here, i am updating first and inserting.. just reverse ) The code looks like: u

[SQL] Multi ordered select and indexing

2004-04-26 Thread Antal Attila
Hi! What is the simplest solution for this query type: SELECT * FROM tablename ORDER BY col1 ASC, col2 DESC; In our experience, postgres cannot use a multi-colum index on (col1, col2) in this situation. Is custom operator class the easiest solution, which can solve the reverse indexing on

[SQL] Postgres backend to backup system

2004-04-26 Thread Kent L. Nasveschuk
Hello, I don't know if this is the forum for this but here goes. I am interested in using Postgres as the backend to a backup system. Does anyone have any experiences or ideas on this? I have a project in mind to develop a web based backup system using PHP that stores backup information in Postgre

[SQL] Postgres DB

2004-04-26 Thread Sumita Biswas
Hi All, Our application is using the Postgres 7.3.4-RH database that is packaged with the AS3.0 for CCM. There is a variable type called refcursor that is being used by CAR Functions in Postgres database. This variable works fine when we execute the postgres Function from the database i.e through

[SQL] Own opclass and LIKE problem again!

2004-04-26 Thread Antal Attila
Hi! Thank you very much the answers for my previous 'Multi ordered select and indexing' question! I tried your suggestions, and those are working well. We found a problem when used '(-col2)' instead of 'col2 DESC'. This solution working as a functional index and in our experience when the planner

Re: [SQL] Join issue on a maximum value

2004-04-26 Thread Atesz
On Wed, Apr 21, 2004 at 14:29:34 -0400, Heflin wrote: > > SELECT auction.auction_id, image.image_id, image.image_descr FROM > auction JOIN image ON auction.auction_id = image.auction_id WHERE > auction.auction_owner = 'Mabel'; > In my opinion there are 2 problem: how can you make the query

[SQL] SQL Query Timeouts

2004-04-26 Thread Dan Field
I have a problem with a select statement that I am using in a web search engine. I have the following SQL: SELECT da_records.TITLE_EN AS TITLE, da_records.AUTHOR_EN AS AUTHOR, da_records.DESCRIPTION_EN AS DESCRIPTION, da_records.PUBLISHER_EN AS PUBLISHER, da_records.URL_EN AS URL, da_reco

[SQL] Own opclass and LIKE problem again!

2004-04-26 Thread Atesz
Hi! Thank you very much the answers for my previous 'Multi ordered select and indexing' question! I tried your suggestions, and those are working well. We found a problem when used '(-col2)' instead of 'col2 DESC'. This solution working as a functional index and in our experience when the planner

Re: [SQL] Python connection

2004-04-26 Thread Karsten Hilbert
a) this is the wrong mailing list for your question b) obviously, it doesn't like the "," part (and possibly the "host" part but that remains to be seen), try separating by ":" or just space or whatever libpq docs say c) any particular reason you don't use the Python DB API ? Karsten -- GPG

Re: [SQL] Trigger calling a function HELP ME! (2)

2004-04-26 Thread Riccardo G. Facchini
--- Richard Huxton wrote: > On Wednesday 21 April 2004 16:16, abief_ag_-postgresql(AT)yahoo.com > wrote: > > > CREATE OR REPLACE FUNCTION public.imp_test_to_out_test(imp_test) > > RETURNS imp_test AS > > 'begin > >return $1; > > end;' > > LANGUAGE 'plpgsql' STABLE; > > > > CRE