Re: [SQL] SELECT ... WHERE ... NOT IN (SELECT ...);

2002-08-28 Thread Yon Den Baguse Ngarso
O, Yes... The problem occure because of null from selecting into tbl2. I have to delete record which eventid=null, and the result become correct. Pls be carefull with Null entri when using NOT IN. Thanks for you all :-) Regards, -Yon- --- Tom Lane <[EMAIL PROTECTED]> wrote: >Yon Den Baguse Nga

[SQL] union optimization in views

2002-08-28 Thread JOE
We are attempting to move a couple of systems from Oracle to Postgres but can not do so without application rewrites due to the current use of views with UNIONs and the criticality of the performances of these views.   I was wondering if a decision has been made on the optimization with the

Re: [SQL] select question

2002-08-28 Thread eric soroos
On Wed, 28 Aug 2002 16:12:41 -0400 in message <[EMAIL PROTECTED]>, george young <[EMAIL PROTECTED]> wrote: > [postgreql 7.2, linux] > I have a table T with columns run, wafer, and test: >T(run text, wafer int, test text) > Given a run and a set of wafers, I need the set of tests that match >

Re: [SQL] select question

2002-08-28 Thread Wei Weng
You can use this query SELECT * FROM T WHERE run = 'a' AND wafer = 1 AND test = 'foo' UNION SELECT * FROM T WHERE run = 'a' AND wafer = 2 AND test = 'foo' UNION SELECT * FROM T WHERE run = 'a' AND wafer = 3 AND test = 'foo' UNION SELECT * FROM T WHERE run = 'a' AND

[SQL] select question

2002-08-28 Thread george young
[postgreql 7.2, linux] I have a table T with columns run, wafer, and test: T(run text, wafer int, test text) Given a run and a set of wafers, I need the set of tests that match *all* the specified wafers: run wafer test a 1 foo a 2 foo a 3 foo a

Re: [SQL] Retrieving the new nextval...

2002-08-28 Thread Jeff Eckermann
--- friedrich nietzsche <[EMAIL PROTECTED]> wrote: > Hi all, > I'm in trouble with the same problem, but in PHP.. > With your solution, I cannot be totally sure that > last > inserted raw was mine... > Because I'm on a web page, it could be that, as soon > as I've inserted my record, another one

Re: [SQL] Case Statement

2002-08-28 Thread Stephan Szabo
On Wed, 28 Aug 2002, Tom Haddon wrote: > Hi Folks, > > I am having troubles with a case statement in that I want to have the query > select only those records that match a particular case. Here's my query: > > SELECT > agency_contact_info.id,organization,department,city,state,description_of_ser >

[SQL] Case Statement

2002-08-28 Thread Tom Haddon
Hi Folks, I am having troubles with a case statement in that I want to have the query select only those records that match a particular case. Here's my query: SELECT agency_contact_info.id,organization,department,city,state,description_of_ser vices, CASE WHEN agency_contact_info.id > 0 THEN 0 EL

Re: [SQL] UPDATE & LIMIT together?

2002-08-28 Thread Bruce Momjian
You have to use a subquery returning the tables primary key to the UPDATE: UPDATE tab SET x=1 WHERE (primkey, col) IN ( SELECT primkey,col FROM tab ORDER BY col LIMIT 10) --

[SQL] nextval...

2002-08-28 Thread friedrich nietzsche
Ok , now I believe it :) thanks to all. danilo __ Yahoo! Musica: notizie, recensioni, classifiche, speciali multimediali http://it.yahoo.com/mail_it/foot/?http://it.music.yahoo.com/ ---(end of broadcast)

Re: [SQL] Retrieving the new "nextval" for primary keys....

2002-08-28 Thread friedrich nietzsche
One solution seems to locking table(s), but I prefer to leave it as last chance... using table locks, and the trick of writing and suddenly reading back from DB it probably works, but it doesn't seems so sexy... :) ciao danilo

Re: [SQL] Retrieving the new nextval...

2002-08-28 Thread friedrich nietzsche
Hi all, I'm in trouble with the same problem, but in PHP.. With your solution, I cannot be totally sure that last inserted raw was mine... Because I'm on a web page, it could be that, as soon as I've inserted my record, another one do an insertion, so I would get the wrong ID... does transactions

Re: [SQL] Retrieving the new "nextval" for primary keys....

2002-08-28 Thread Kevin Brannen
Greg Patnude wrote: > I am using postgreSQL with Perl::CGI and Perl::DBI::Pg... I would like to be > able to insert a row from my Perl script [$SQL->exec();] and have postgreSQL > return the id of the newly inserted record (new.id) directly to the Perl > script for further processing... Anyone wit

[SQL] UPDATE & LIMIT together?

2002-08-28 Thread tp
Hi I want to SELECT at max. 10 rows and SET a variable for the select 10 rows with the same query. Under mysql i can use: UPDATE table SET uniq_iq=12345 LIMIT 10 SELECT * FROM table WHERE uniq_id=1234; This is not supported by postgres. Is there some easy solution that does not require locking

Re: [SQL] Problems with version 7.1, could they be fixed in 7.2?

2002-08-28 Thread Ligia Pimentel
Ok. Got It. I thought that would help, also. Thanks. Ligia "Stephan Szabo" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Mon, 26 Aug 2002, Ligia Pimentel wrote: > > > I've been having problems with a database in postgres 7.1, this database > > worked jus

Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1?

2002-08-28 Thread Vivek Khera
> "BM" == Bruce Momjian <[EMAIL PROTECTED]> writes: BM> OK, no one has commented on this, so I guess I am going to have to guess BM> the group's preference. BM> My guess, seeing as very few probably use LIMIT and FOR UPDATE together, BM> is to swap them and document it in the release notes.

Re: [SQL] SERIAL parameters

2002-08-28 Thread Bruce Momjian
You can create the sequence manually and define that a the default for the column. I suppose we could pass the create sequence params through SERIAL but there doesn't seem like there is much demand for it. --- Arnold Puton

Re: [SQL] Problems with version 7.1, could they be fixed in 7.2?

2002-08-28 Thread Stephan Szabo
On Mon, 26 Aug 2002, Ligia Pimentel wrote: > I've been having problems with a database in postgres 7.1, this database > worked just fine for about 6 months, but it is a fast growing database (a > lot of records inserted every day, almost none deleted). > > The problem is that the database started

[SQL] VIRUS IN MAIL FOR YOU FROM

2002-08-28 Thread postmaster
A virus-infected attachment in a message sent to you from <[EMAIL PROTECTED] > was detected by the campus central mail servers. Delivery of that message has been blocked. If you know the sender, you may want to contact the sender and have the message re-sent after cleaning

[SQL] Help needed

2002-08-28 Thread Mowat, Paul
Dear postgresql, I am just starting to learn SQL. I have attached a script that allows me to create some tables and indexes. I have rows that are inserted into the tables.   I need some help with creating multiple subqueries and table joins, (six or seven table joins). Can you help? Paul Mo

[SQL] SERIAL parameters

2002-08-28 Thread Arnold Putong
Would it be possible to have parameters in the SERIAL datatype? CREATE TABLE x { ID SERIAL(100, 10) } means ID starts at 100 and will be incremented by 10. And it would be nice to have CREATE TABLE x { ID SERIAL(0,0) } mean that ID will be issued random non-repeating values (period=2^bitwid

[SQL] Can I use "UPDATE" sql statement in trigger before or after update ?

2002-08-28 Thread Ivan Jordanov
Can I use "UPDATE" sql statement in trigger before or after update, without refire the trigger again ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

Re: [SQL] Problems with version 7.1, could they be fixed in 7.2?

2002-08-28 Thread mark carew
Hi Ligia, Are you running VACUUM ANALYSE or is it VACUUM ANALYZE (can never remember, though reasonably sure that its the former). Regards Mark Carew Brisbane Australia ---(end of broadcast)--- TIP 1: subscribe and unsubscribe comman

[SQL] Year of the week : How to ?

2002-08-28 Thread Emmanuel Guyot
How to retrieve the year based on week of a date ? If I use datepart('year', aDate), I get the year of the date. If I use datepart('week', aDate), I get the week of the date. But these aren't corelated. So when aDate is Dec 31st 2001, I get 2001, and the week is 1. I'd like to have 2002 for the y

Re: [SQL] SELECT ... WHERE ... NOT IN (SELECT ...);

2002-08-28 Thread OU
I use a 7.3devel recently build (on a FreeBSD 4.3 box) from CVS sources. I follow all your steps, and psql results : test_db=> \! cat problem.sql --create new temp tbl1 SELECT losteventid AS eventid INTO tbl1 FROM outages; --create new temp tbl2 SELECT regainedeventid AS eventid INTO tbl2 FROM o

[SQL] Problems with version 7.1, could they be fixed in 7.2?

2002-08-28 Thread Ligia Pimentel
I've been having problems with a database in postgres 7.1, this database worked just fine for about 6 months, but it is a fast growing database (a lot of records inserted every day, almost none deleted). The problem is that the database started corrupting indexes, and tables (even system tables,

Re: [SQL] Separating data sets in a table

2002-08-28 Thread OU
"Andreas Tille" <[EMAIL PROTECTED]> a écrit dans le message de news: [EMAIL PROTECTED] ... > I tried to do the following approach: > >CREATE LOCAL TEMPORARY TABLE ImportOK () INHERITS (Import) ; > >INSERT INTO ImportOK SELECT * FROM Import i > INNER JOIN Ref r ON i.Id = r.Id;

[SQL] Retrieving the new "nextval" for primary keys....

2002-08-28 Thread Greg Patnude
I am using postgreSQL with Perl::CGI and Perl::DBI::Pg... I would like to be able to insert a row from my Perl script [$SQL->exec();] and have postgreSQL return the id of the newly inserted record (new.id) directly to the Perl script for further processing... Anyone with a solution / idea ??? Nea

Re: [SQL] triggers and plpgsql question

2002-08-28 Thread Mathieu Arnold
--On mercredi 28 août 2002 08:42 +0200 Mathieu Arnold <[EMAIL PROTECTED]> wrote: > > > --On mardi 27 août 2002 15:38 -0700 Josh Berkus <[EMAIL PROTECTED]> wrote: > >> >> Mathieu, >> >>> The thing I need, is to be able to know what does NEW contains, and I >>> have not found out any mean to

Re: [SQL] signed/unsigned integers

2002-08-28 Thread Christopher Kings-Lynne
> Is it true, that I can't define unsigned integers in a table definition? > > CU Roger I'm not aware of any unsigned types in Postgres. You could probably define your own one though. Chris ---(end of broadcast)--- TIP 2: you can get off all lis

[SQL] signed/unsigned integers

2002-08-28 Thread Roger Mathis
Hi Is it true, that I can't define unsigned integers in a table definition? CU Roger ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/users-lounge/docs/faq.html

Re: [SQL] "reverse()" on strings

2002-08-28 Thread h012
Jeff & Josh, thanks for showing me a solution ! John PS: just curious: is there anything I can do to affect effectiveness of the cache, when ISCACHABLE is used ? (I.e. size / expiring algorithm, or order of inputs - E.g. when building the index, is there anything that would order the i

[SQL] unsubscribe

2002-08-28 Thread Gaetano Mendola
unsubscribe ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]