Re: [SQL] Aggregates with NaN values

2008-12-05 Thread Mark Roberts
On Thu, 2008-12-04 at 13:01 -0500, Sean Davis wrote: > I am happy to see NaN and infinity handled in input. I would now like > to compute aggregates (avg, min, max, etc) on columns with NaN values > in them. The standard behavior (it appears) is to have the aggregate > return NaN if the data con

Re: [SQL] Left Join Question

2008-11-18 Thread Mark Roberts
On Tue, 2008-11-18 at 16:48 -0600, Ryan Wells wrote: > Since it works, my question is really more about principles: Given > that each of the tables in question will contain tens of thousands of > rows, is a nested join really the best way to approach this? I don't see what's wrong with it. The

Re: [SQL] For each key, find row with highest value of other field

2008-10-03 Thread Mark Roberts
select distinct on (Key) Key, Date, Value from <> order by Key, Date desc MYDATABASE=> create table aaa (key varchar(1), date date, value text); CREATE TABLE Time: 1518.002 ms MYDATABASE=> insert into aaa (key, date, value) values ('A', '2008-05-01', 'foo'); INSERT 0 1 Time: 1.125 ms MYDATABASE=>

Re: [SQL] exclusion query

2008-09-22 Thread Mark Roberts
On Mon, 2008-09-22 at 16:34 +0200, Louis-David Mitterrand wrote: > > > To select person_type's used in a certain event_type I have this > query: > > select distinct pt.type > from person_type pt > natural join person_to_event > join event e using (id_event) >

Re: [SQL] RE: [SQL] Why *no* ambig.uous complain in select part?

2008-08-22 Thread Mark Roberts
On Fri, 2008-08-22 at 17:10 -0400, Emi Lu wrote: > > Would you please give me an example? > > I have two tables like the following: > T1 (col1 varchar, col2 varchar, primary key (col1, col2)) > T2 (col1 varchar, col2 varchar, primary key (col1, col2)) > > > Query I have is: > =

Re: [SQL] Question on partitioning

2008-08-21 Thread Mark Roberts
On Thu, 2008-08-21 at 15:25 +0100, Oliveiros Cristina wrote: > Hello , All. > > I am not sure if this is the right mailing list to place this > question. > If it doesn't, please kindly redirect me to the right list. > > I have a giant table with about 10,6 million records. > > Queries on it

Re: [SQL] DELETE with JOIN

2008-08-07 Thread Mark Roberts
On Thu, 2008-08-07 at 09:14 -0700, [EMAIL PROTECTED] wrote: >DELETE FROM a WHERE a.b_id = b.id AND b.second_id = ? > This should work for your needs: delete from a using b where a.id = b.id -- join criteria and b.second_id = ? > I have tried to do this before and always found a way, usually

Re: [SQL] more than 1000 connections

2008-08-06 Thread Mark Roberts
On Wed, 2008-08-06 at 08:06 +0800, Craig Ringer wrote: > Out of interest - why 1000 connections? > > Do you really expect to have 1000 jobs concurrently active and doing > work? If you don't, then you'll be wasting resources and slowing > things > down for no reason. There is a connection overhea

Re: [SQL] pg_advisory_lock(bigint) vs. LOCK TABLE

2008-07-18 Thread Mark Roberts
On Thu, 2008-07-17 at 12:16 -0400, Alvaro Herrera wrote: > Volkan YAZICI wrote: > > Hi, > > > > What's the difference between below two queue implementations? > > They are two different lock spaces. pg_advisory_lock does not conflict > with regular system locks, whereas LOCK TABLE does. > > >

Re: [SQL] How to GROUP results BY month

2008-07-16 Thread Mark Roberts
On Wed, 2008-07-16 at 07:39 +0200, A. Kretschmer wrote: > am Tue, dem 15.07.2008, um 18:15:07 -0700 mailte Mark Roberts > folgendes: > > > > On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer wrote: > > > am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oli

Re: [SQL] How to GROUP results BY month

2008-07-15 Thread Mark Roberts
On Tue, 2008-07-15 at 14:31 +0200, A. Kretschmer wrote: > am Tue, dem 15.07.2008, um 13:12:39 +0100 mailte Oliveiros Cristina > folgendes: > > Howdy, all, > > > > I have a problem. > > > > I have a table which one of the fields is of type date. > > > > I need to obtain the totals of the other

Re: [SQL] Rollback in Postgres

2008-07-11 Thread Mark Roberts
On Fri, 2008-07-11 at 11:43 -0400, samantha mahindrakar wrote: > Hi all > This is a very basic question.can we roll back data after we run a > query. > I know that a delete within a transaction can be rolled back. But how > about independent delete queries??? > If i ran a delete statement

Re: [SQL] Different type of query

2008-06-11 Thread Mark Roberts
On Wed, 2008-06-11 at 14:41 -0400, PostgreSQL Admin wrote: > I would like to have multiple values nutrient_no: > ndb_no | nutrient_no | nutrient_value > +-+ > 13473 | 203 | 24.18 > 13473 | 204 | 15.93 > 13473 | 205 |

Re: [SQL] Unable to create function which takes no arguments

2008-06-09 Thread Mark Roberts
IIRC, current_timestamp doesn't require parens. You could try something like this: select extract(epoch from current_timestamp)::int4 as result; -Mark On Mon, 2008-06-09 at 12:05 -0400, Michael Eshom wrote: > I am a project manager for a popular forum system. We are adding > support for PostgreS

[SQL] Postgres 8 - Database access, new install.

2005-02-24 Thread Mark Roberts
Hi all, Ive just installed the latest version of Postgres 8 on a RedHat 9 server. The problem im having is than when I try to login to the database i.e. 'psql -U postgres template1' im getting the following message:   psql: relocation error: psql: undefined symbol: PQsetErrorVerbosity   Upon rea

Re: [SQL] Date format problems

2004-02-16 Thread Mark Roberts
nd Regards, Mark. >>> Tom Lane <[EMAIL PROTECTED]> 02/16/04 03:34pm >>> "Mark Roberts" <[EMAIL PROTECTED]> writes: > Hi im using the function below to insert data into my db; im using > now() to get the timestamptz, however when inserted in the db the for

[SQL] Date format problems

2004-02-16 Thread Mark Roberts
Hi im using the function below to insert data into my db; im using now() to get the timestamptz, however when inserted in the db the format seems to vary, the majority of the time its in the required European style but does spontaniously change to various other type can anyone throw any light on t

[SQL] timestamptz - problems

2004-02-09 Thread Mark Roberts
Hi im using 'timestamptz' in a function called: 'getdate' to enter the start and finish time into a db field, however the date appears to be inserted into the db in a random format, i wish for it to only be entered into the db as DD-MM- (European,UK). I understand this is probably a very simpl

[SQL] Unsubscribe

2003-10-01 Thread Mark Roberts
please remove my email from your database contacts. Kind Regards, Mark. ___ Disclaimer: Great Ormond Street Hospital for Children NHS Trust SECURITY WARNING RE: PATIENT OR OTHER CONFIDENTIAL DATA. Please note that Internet E-mail is simply not a secure communi

[SQL] unsubscribe

2003-07-29 Thread Mark Roberts
unsubscribe ___ Disclaimer: Great Ormond Street Hospital for Children NHS Trust SECURITY WARNING RE: PATIENT OR OTHER CONFIDENTIAL DATA. Please note that Internet E-mail is simply not a secure communication medium. We strongly advise that you understand &