Re: [SQL] max question

2005-04-12 Thread Dinesh Pandey
Try "select oid,* from ccontinue where citkey ='04-0594703' group by oid,citkey,contby,contdate,abcontinue,ccdate having contdate= max(contdate)" Thanks Dinesh Pandey -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of A. R. Van Hook Sent: Tuesday, April 12,

Re: [SQL] ignore single character in SELECT query?

2005-04-12 Thread Dinesh Pandey
Use select replace(quote_literal('don\'t'), '\'', ''); Or select replace(quote_ident(myColumnName, '\'', ''); Thanks Dinesh Pandey -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, April 13, 2005 8:16 AM To: pgsq

Re: [SQL] ignore single character in SELECT query?

2005-04-12 Thread Greg Stark
[EMAIL PROTECTED] writes: > So basically I want to ignore a single character (the apostrophe > character), anywhere in the middle of my search word, in selecting > results. How can I do this? WHERE replace(name,,'') like '%dont%' Beware of quoting issues if "dont" is coming from user suppl

Re: [SQL] max question

2005-04-12 Thread Tom Lane
"A. R. Van Hook" <[EMAIL PROTECTED]> writes: > I am trying to pull rows that have the max. contdate. Why does the > following give more than 2 rows? > ql "select oid,* from ccontinue where citkey ='04-0594703' group by > oid,citkey,contby,contdate,abcontinue,ccdate having max(contdate) = > cont

Re: [SQL] Query runs very slowly in Postgres, but very fast in other DBMS

2005-04-12 Thread Andrus
>> SELECT dokumnr FROM rid WHERE dokumnr NOT IN >> (select dokumnr FROM dok); > ... >> Is it possible to speed up this query is Postgres ? How to force Postgres >> to use indexes for this query ? > > Use IN and NOT IN only for small sets. Use JOIN (instead of IN) and LEFT > JOIN (instead of NOT I

Re: [SQL] Query runs very slowly in Postgres, but very fast in other DBMS

2005-04-12 Thread Ezequiel Tolnay
Andrus Moor wrote: SELECT dokumnr FROM rid WHERE dokumnr NOT IN (select dokumnr FROM dok); ... Is it possible to speed up this query is Postgres ? How to force Postgres to use indexes for this query ? Use IN and NOT IN only for small sets. Use JOIN (instead of IN) and LEFT JOIN (instead of NOT IN

Re: [SQL] Getting the output of a function used in a where clause

2005-04-12 Thread Bill Lawrence
Thanks a bunch! Looks pretty step-by-step at the site for the link you sent. I'll give it a shot and see how it turns out. Thanks again for all your help! Bill -Original Message- From: PFC [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 12, 2005 1:03 AM To: Bill Lawrence Subject: Re: [SQL

[SQL] operating "inet" type

2005-04-12 Thread Ilya A. Kovalenko
Greetings, I'm confused, that PostgreSQL seems to don't have operators/functions for examining/modifying "inet" data type. No any octet/word-based means (like extract/replace), no even, trivial integer increments. No conversions, except conversion to symbolic string (parsing it is a mess

[SQL] max question

2005-04-12 Thread A. R. Van Hook
I have the following in a table: oid | citkey | contby | contdate | abcontinue | ccdate -++--+++ 5774835 | 04-0594703 | ||| 5775325 | 04-0594703 | Attorney | 04/06/2005 | 6 | 03

Re: [SQL] Query runs very slowly in Postgres, but very fast in other DBMS

2005-04-12 Thread Dan Feiveson
You might also try: SELECT dokumnr FROM rid WHERE NOT EXISTS ( SELECT 'd' FROM dok WHERE dok.dokumnr = rid.dokumnr ); Dan Feiveson DataJoe LLC - Original Message - From: "Krasimir Dimitrov" <[EMAIL PROTECTED]> To: "Andrus Moor" <[EMAIL PROTECTED]> Cc: Sent: Tuesday, April 12, 2

[SQL] ignore single character in SELECT query?

2005-04-12 Thread jspring
Given select criteria "dont" I would like to return rows with values "don't". Or similarily I want rows with "they're" given input criteria "theyre". So basically I want to ignore a single character (the apostrophe character), anywhere in the middle of my search word, in selecting results. How c

Re: [SQL] getting count for a specific querry

2005-04-12 Thread Scott Marlowe
On Tue, 2005-04-12 at 15:32, Vivek Khera wrote: > On Apr 12, 2005, at 4:23 PM, Scott Marlowe wrote: > > > How much memory is in the box? I've heard horror stories about > > performance with >2 gigs of ram, which is why I made them order mine > > with 2 gigs. Does the 3/DC have battery backed cac

Re: [SQL] getting count for a specific querry

2005-04-12 Thread Vivek Khera
On Apr 12, 2005, at 4:23 PM, Scott Marlowe wrote: How much memory is in the box? I've heard horror stories about performance with >2 gigs of ram, which is why I made them order mine with 2 gigs. Does the 3/DC have battery backed cache set to write back? 4GB RAM and battery backed cache set to w

Re: [SQL] getting count for a specific querry

2005-04-12 Thread Scott Marlowe
On Tue, 2005-04-12 at 14:29, Vivek Khera wrote: > On Apr 8, 2005, at 4:50 PM, Scott Marlowe wrote: > > > Do you run your 2650s with hyperthreading on? I found that slowed mine > > down under load, but we never had more than a couple dozen users > > hitting > > the db at once, so we may well have

Re: [SQL] Query history file

2005-04-12 Thread Vivek Khera
On Apr 5, 2005, at 11:29 AM, Mauro Bertoli wrote: From the server side, if you enable 'log_statement' all queries will go into the server logs. Thank you, I enabled log_statement = all log_duration = true You may also want log_min_error_statement = error else any statement that causes an error (suc

Re: [SQL] getting count for a specific querry

2005-04-12 Thread Vivek Khera
On Apr 8, 2005, at 4:50 PM, Scott Marlowe wrote: Do you run your 2650s with hyperthreading on? I found that slowed mine down under load, but we never had more than a couple dozen users hitting the db at once, so we may well have had a different load profile than what you're seeing. Yep. Turned o

Re: [SQL] Update aborted if trigger function fails?

2005-04-12 Thread Carlos Moreno
Andrew Sullivan wrote: On Tue, Apr 12, 2005 at 10:55:30AM -0400, Carlos Moreno wrote: I guess the concern came up as result of a particular situation, in which failing to properly process the trigger function is not that crucial (I wanted to update some additional information that is "optional", an

Re: [SQL] Update aborted if trigger function fails?

2005-04-12 Thread Andrew Sullivan
On Tue, Apr 12, 2005 at 10:55:30AM -0400, Carlos Moreno wrote: > > I guess the concern came up as result of a particular > situation, in which failing to properly process the > trigger function is not that crucial (I wanted to > update some additional information that is "optional", > and that can

Re: [SQL] Update aborted if trigger function fails?

2005-04-12 Thread Carlos Moreno
Richard Huxton wrote: I just noticed this (odd?) behaviour, and it kind of scares me. Isn't this a little fragile? Is there something I could do to avoid this situation? Should trigger functions be extremely simple as to guarantee that an error would never happen? There's nothing else it can do,

Re: [SQL] Getting the output of a function used in a where clause

2005-04-12 Thread Scott Marlowe
Why not just do: SELECT zipcode, zipdist($lat1d,$lon1d,lat,long) as distance from zipcodes where zipdist($lat1d,$lon1d,lat,long) <= $dist;"; On Mon, 2005-04-11 at 20:25, Bill Lawrence wrote: > Boy I sure thought that would work... I received the following from postgres: > > ERROR: Attribute "d

Re: [SQL] OpenFTS

2005-04-12 Thread Oleg Bartunov
Dan, how large is your database ? OpenFTS is what you need because it supports instant indexing and have access to metadata. I heard about some large archives up to 10 mln documents, which use OpenFTS. Proper tuning of database setup in general and OpenFTS is required. In case you want commercial s

Re: [SQL] Update aborted if trigger function fails?

2005-04-12 Thread Richard Huxton
Carlos Moreno wrote: Hi, I just noticed this (odd?) behaviour, and it kind of scares me. Isn't this a little fragile? Is there something I could do to avoid this situation? Should trigger functions be extremely simple as to guarantee that an error would never happen? There's nothing else it can