Re: [SQL] Unique Constraint Based on Date Range

2003-09-22 Thread Manfred Koizar
On Sat, 20 Sep 2003 18:55:34 -0400, Kevin Houle <[EMAIL PROTECTED]> wrote: > SELECT INTO result * FROM table_rates WHERE > effective_date >= NEW.effective_date AND > expiry_date <= NEW.expiry_date AND > cost = NEW.cost; > IF FOUND THEN >RAISE EXCEPTION ''record ove

Re: [SQL] Q: select query

2003-09-13 Thread Manfred Koizar
On 12 Sep 2003 10:58:45 -0700, [EMAIL PROTECTED] (G. Ralph Kuntz, MD) wrote: >I would like to select the second and subsequent rows where the first >column is the same: > > 1 b > 1 c > 3 f > >in other words, all but the first row of a group. all = SELECT * FROM t; but =

Re: [SQL] plpgsql doesn't coerce boolean expressions to boolean

2003-09-09 Thread Manfred Koizar
On Mon, 08 Sep 2003 11:40:32 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: >4. Use the parser's coerce_to_boolean procedure, so that nonbooleans > will be accepted in exactly the same cases where they'd be accepted > in a boolean-requiring SQL construct (such as CASE). (By default, > none are,

Re: [SQL] Let join syntax

2003-06-16 Thread Manfred Koizar
On Mon, 16 Jun 2003 12:34:34 +0200, "Nicolas JOUANIN" <[EMAIL PROTECTED]> wrote: >from >coh x0 , cpy x1 ,bra x2 , >cur x3 ,tad x4 LEFT OUTER JOIN sec x5 on x5.thr_id=x4.thr_id AND >x5.usr_id=x0.usr_id AND x5.bra_id = x0.bra_id AND x5.dpr_id = x0.dpr_id, >dpr x6 where ((x0.cpy_i

Re: [SQL] Let join syntax

2003-06-16 Thread Manfred Koizar
On Mon, 16 Jun 2003 12:34:34 +0200, "Nicolas JOUANIN" <[EMAIL PROTECTED]> wrote: >from >coh x0 , cpy x1 ,bra x2 , >cur x3 ,tad x4 LEFT OUTER JOIN sec x5 on x5.thr_id=x4.thr_id AND >x5.usr_id=x0.usr_id AND [...] > >Unfortunatelly, postgres returns me the following error : > Error: ERR

Re: [SQL] What's wrong with this group by clause?

2003-03-14 Thread Manfred Koizar
On Thu, 13 Mar 2003 01:34:34 -0600, "Len Morgan" <[EMAIL PROTECTED]> wrote: >>GROUP BY > > field1, > > field2, > >name; >I think the problem is that you don't have a column to group on. field1, field2, and name are the grouping columns. >Try adding >SELECT ,count(*) so that there is an

Re: [SQL] What's wrong with this group by clause?

2003-03-13 Thread Manfred Koizar
[forwarding to -hackers] On Tue, 4 Nov 2003 18:28:12 -0300, Franco Bruno Borghesi <[EMAIL PROTECTED]> wrote: >Below you can find a simplified example of a real case. >I don't understand why I'm getting the "john" record twice. ISTM you have found a Postgres 7.3 bug. I get one john with Postgr

Re: [SQL] Debugging postmaster to fix possible bug in Postgres? Followup

2003-02-13 Thread Manfred Koizar
On Thu, 13 Feb 2003 17:50:22 -0500, Dmitry Tkach <[EMAIL PROTECTED]> wrote: >Then it looks like postgres behaviour is still not compliant, if I read it correctly, >because > >select x from mytable order by y; > >should be invalid according to this, but works just fine in postres. Yes, this is a P

Re: [SQL] performance question

2003-01-20 Thread Manfred Koizar
On Mon, 20 Jan 2003 18:10:24 +0100 (CET), "Moritz Lennert" <[EMAIL PROTECTED]> wrote: >I'll try that, although I haven't changed any of the tuples since import >of the data (this is a static table...) Then I must have miscalculated something :-( What does VACUUM VERBOSE ANALYZE say? >> From wha

Re: [SQL] performance question

2003-01-20 Thread Manfred Koizar
On Mon, 20 Jan 2003 12:40:34 +0100 (CET), "Moritz Lennert" <[EMAIL PROTECTED]> wrote: >I have a table with some 2.2 million rows on a Pentium4, 1.8GHz with 512 >MB RAM. >Some queries I launch take quite a long time, and I'm wondering whether >this is normal,or whether I can get better performance s

Re: [SQL] NULLL comparison in multiple column unique index

2003-01-03 Thread Manfred Koizar
On Thu, 02 Jan 2003 17:19:52 -0600, "Brian Walker" <[EMAIL PROTECTED]> wrote: >create table test1 (name varchar(64),num1 int,num2 int); >create unique index idx1 on test1(name,num1); >insert into idx1 values ('row3',null,22); >insert into idx1 values ('row3',null,23); > >This is allowed to happen.

Re: [SQL] error in copy table from file

2002-12-11 Thread Manfred Koizar
On Wed, 11 Dec 2002 18:40:48 +0100, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: >copy table from 'path/file' using delimiters ';' > >it returns the following: > >'RROR: copy: line 1, Bad float8 input format '-0.123 ^ This belongs to the end of the error message. Finding it here at the beginni

Re: [SQL] join question

2002-11-28 Thread Manfred Koizar
On Wed, 27 Nov 2002 09:37:07 -0800, Nathan Young <[EMAIL PROTECTED]> wrote: >OK, that works great, but I was told that I should avoid sub-selects when >possible for performance reasons. >> >> select member.memberId, member.name from member left outer join >> (select * from payment where yearPaid=

Re: [SQL] Updating from select

2002-10-02 Thread Manfred Koizar
On Wed, 02 Oct 2002 19:11:19 +0200, Thrasher <[EMAIL PROTECTED]> wrote: >UPDATE trans_log t SET t.cost = > (SELECT SUM(p.cost) FROM products_log p WHERE p.trans = t.id) Thrasher, try it without the table alias t: UPDATE trans_log SET cost = (SELECT SUM(p.cost) FROM products_log p WHERE

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-24 Thread Manfred Koizar
On Tue, 24 Sep 2002 17:56:51 -0400 (EDT), Bruce Momjian <[EMAIL PROTECTED]> wrote: >Can you run a test: > > BEGIN; > SELECT CURRENT_TIMESTAMP; > wait 5 seconds > SELECT CURRENT_TIMESTAMP; > >Are the two times the same? MS SQL 7: begin transaction insert int

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-24 Thread Manfred Koizar
On Mon, 23 Sep 2002 23:35:13 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: >If you want to change 'current_timestamp' to >conform to a rather debatable reading of the spec, [...] Well the spec may be debatable, but could you please explain why my reading of the spec is debatable. The spec says "dur

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-24 Thread Manfred Koizar
On Mon, 23 Sep 2002 16:55:48 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: >Bruce Momjian <[EMAIL PROTECTED]> writes: >Here's an example: > >CREATE RULE foo AS ON INSERT TO mytable DO >( INSERT INTO log1 VALUES (... , now(), ...); > INSERT INTO log2 VALUES (... , now(), ...) ); > >I think it's impor

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-24 Thread Manfred Koizar
On Mon, 23 Sep 2002 13:36:59 -0700, Josh Berkus <[EMAIL PROTECTED]> wrote: >I, for one, would judge that the start time of the statement is "during the >execution"; it would only NOT be "during the execution" if it was a value >*before* the start time of the statement. It's a semantic argument.

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-24 Thread Manfred Koizar
On Tue, 24 Sep 2002 11:19:12 +1000, Martijn van Oosterhout <[EMAIL PROTECTED]> wrote: >Well, what I would suggest is that when you wrap several statements into a >single transaction with begin/commit, the whole lot could be considered a >single statement (since they form an atomic transaction so i

Re: [SQL] [GENERAL] CURRENT_TIMESTAMP

2002-09-23 Thread Manfred Koizar
On Mon, 23 Sep 2002 13:05:42 -0400, Tom Lane <[EMAIL PROTECTED]> wrote: >Manfred Koizar <[EMAIL PROTECTED]> writes: >> This has been discussed before and I know I'm going to get flamed for >> this, but IMHO having now() (which is a synonym for CURRENT_TIMESTAMP)

Re: [SQL] [GENERAL] Monitoring a Query

2002-09-23 Thread Manfred Koizar
On Mon, 23 Sep 2002 11:06:19 -0400 (EDT), Bruce Momjian <[EMAIL PROTECTED]> wrote: >Tom Lane wrote: >> It would be nearly free to include the start time of the current >> transaction, because we already save that for use by now(). Is >> that good enough, or do we need start time of the current qu

Re: [SQL] Table alias in DELETE statements

2002-09-13 Thread Manfred Koizar
On Fri, 13 Sep 2002 14:10:25 +0200, Hanno Wiegard <[EMAIL PROTECTED]> wrote: >So the question for me is whether it is possible >to use a table alias in a DELETE statement or not, e.g. >DELETE FROM foo f WHERE f.ID > 3000 (more complicated cases in reality Hanno, looks like you are out of luck h

Re: [SQL] sql group by statement

2002-09-13 Thread Manfred Koizar
On Fri, 13 Sep 2002 12:29:21 +0200, "Albrecht Berger" <[EMAIL PROTECTED]> wrote: >Table : >pk id val1 val2 > 112 3 > 212 4 > 321 1 > 410 5 > 521 8 > > >Needed Result : >pk id val1 val2 > 410 5 > 521 8 Albrecht, "DISTI

Re: [SQL] [HACKERS] please help on query

2002-07-11 Thread Manfred Koizar
On Thu, 11 Jul 2002 19:40:46 +0200, "Luis Alberto Amigo Navarro" <[EMAIL PROTECTED]> wrote: >I've tried [reformatted to fit on one page] | SELECT supplier.name, supplier.address | FROM supplier, nation, lineitem You already found out that you do not need lineitem here. | WHERE EXISTS( | SELECT

Re: [SQL] [HACKERS] please help on query

2002-07-11 Thread Manfred Koizar
[moving to pgsql-sql] On Thu, 11 Jul 2002 17:22:14 +0200, "Luis Alberto Amigo Navarro" <[EMAIL PROTECTED]> wrote: >I can't improve performance on this query: > >SELECT > supplier.name, > supplier.address >FROM > supplier, > nation >WHERE > supplier.suppkey IN( > SELECT > partsupp.suppkey > FRO

Re: [SQL] sql statement how to do ?

2002-07-05 Thread Manfred Koizar
On Fri, 5 Jul 2002 09:03:38 + (UTC), [EMAIL PROTECTED] wrote: >INSERT INTO auftrag (SELECT * FROM auftrag where a_id = '12345'); > >The problem is, that the table auftrag has a primay key called pk_auftrag. >Do this I get an error regarding duplicate pk_auftrag. Is there a way to >spare pk_auf

Re: [SQL] Please help me out on this insert error

2002-06-13 Thread Manfred Koizar
On Thu, 13 Jun 2002 13:16:29 +0800, Vernon Wu <[EMAIL PROTECTED]> wrote: > >Command: > >Insert into profile (userid, haveChildren)values('id98', 'No'); > >Error: > >ERROR: Relation 'profile' does not have attribute 'havaChildren' ^

Re: [SQL] join question - three tables, two with foreign keys to the first

2002-06-13 Thread Manfred Koizar
On Fri, 14 Jun 2002 00:13:22 +1000, "Dmitri Colebatch" <[EMAIL PROTECTED]> wrote: >select emp.name, lv.from_date, lv.to_date, pay.amount >from employee as emp >left outer join employee_leave as lv on emp.id = lv.employee_id >left outer join employee_pay as pay on emp.id = pay.employee_id >where em