Re: [GENERAL] [SQL] Set Membership operator -- test group membership

2005-06-19 Thread Oleg Bartunov
Look contrib/intarray On Tue, 14 Jun 2005, Sophie Yang wrote: Say I have a table tbl1 with two columns: tbl1(a integer, b integer, c integer) I want to select the rows in which a and b are members of a list of integer pairs. The SQL in my mind is something like: select * from tbl1 where (a,

Re: [GENERAL] Foreign key to a view (UNION of two or more tables), any alternative?

2005-06-19 Thread Jose Gonzalez Gomez
On 6/17/05, Bruno Wolff III <[EMAIL PROTECTED]> wrote: > On Fri, Jun 17, 2005 at 14:35:01 +0200, > Jose Gonzalez Gomez <[EMAIL PROTECTED]> wrote: > > > > The problem comes when you have questions that may be not applicable > > (8), or optional (doesn't know, doesn't answer) (9). The easy solution

Re: [GENERAL] Foreign key to a view (UNION of two or more tables),

2005-06-19 Thread Karl O. Pinc
On 06/19/2005 11:16:34 AM, Jose Gonzalez Gomez wrote: On 6/17/05, Bruno Wolff III <[EMAIL PROTECTED]> wrote: > On Fri, Jun 17, 2005 at 14:35:01 +0200, > Jose Gonzalez Gomez <[EMAIL PROTECTED]> wrote: > > > > The problem comes when you have questions that may be not applicable > > (8), or optio

[GENERAL] user/groups query ?

2005-06-19 Thread Zlatko Matić
Hello.   How to make a query that will include information both about user and group (or groups) he belongs to ? Thanks.

[GENERAL] subqueries

2005-06-19 Thread Tomasz Grobelny
I have such a statement: select * from (subquery1) as foo, (subquery2) as bar; Both subqueries are reasonably fast (<0.5s) and generate results that have several (<10) rows but the whole query takes forever to execute. Moreover if I simplify those subqueries (limiting functionality) the whole sel

Re: [GENERAL] subqueries

2005-06-19 Thread Sean Davis
- Original Message - From: "Tomasz Grobelny" <[EMAIL PROTECTED]> To: Sent: Sunday, June 19, 2005 6:12 PM Subject: [GENERAL] subqueries I have such a statement: select * from (subquery1) as foo, (subquery2) as bar; Both subqueries are reasonably fast (<0.5s) and generate results that

Re: [GENERAL] subqueries

2005-06-19 Thread Tomasz Grobelny
On Monday 20 of June 2005 00:35, you wrote: > - Original Message - > From: "Tomasz Grobelny" <[EMAIL PROTECTED]> > To: > Sent: Sunday, June 19, 2005 6:12 PM > Subject: [GENERAL] subqueries > > >I have such a statement: > > select * from (subquery1) as foo, (subquery2) as bar; > > Both subq

[GENERAL] Insert behavior in transaction

2005-06-19 Thread Andres
Hi I'm having a problem that looks like a dead lock. I have a batch that performs simple inserts over a single table. The only restriction that this table have is that one of its fields must be unique. There are many of those batches running concurrently. I want the batch to fail and discard a

Re: [GENERAL] subqueries

2005-06-19 Thread Tom Lane
Tomasz Grobelny <[EMAIL PROTECTED]> writes: > I have such a statement: > select * from (subquery1) as foo, (subquery2) as bar; > Both subqueries are reasonably fast (<0.5s) and generate results that have > several (<10) rows but the whole query takes forever to execute. The above is an unconstrai

[GENERAL] unicode and =

2005-06-19 Thread Grant Morgan
= is not working on a char(30) coloumn for me. I want to find rows with equal name. I have my database set to unicode. SQL1 SELECT h1.key,h1.name,h2.key,h2.name FROM table1 as h1, table1 as h2 WHERE h1.name=h2.name and h1.OID = 730716 produces result rows where name doe not match name is multib

Re: [GENERAL] Insert behavior in transaction

2005-06-19 Thread Tom Lane
"Andres" <[EMAIL PROTECTED]> writes: > I did this simple test and it fails too. > BEGIN (first transaction) > INSERT INTO mytable VALUES(1); > On other client > BEGIN (second transaction) > INSERT INTO mytable VALUES(0); > INSERT INTO mytable VALUES(1); > and it freezes waiting for the first o c

Re: [GENERAL] unicode and =

2005-06-19 Thread Tom Lane
"Grant Morgan" <[EMAIL PROTECTED]> writes: > = is not working on a char(30) coloumn for me. > I want to find rows with equal name. > I have my database set to unicode. I'll bet you are running the postmaster in a locale that isn't expecting utf-8 encoding. The locale and encoding have to match or

[GENERAL] plpgsql constraint checked data fails to restore

2005-06-19 Thread Lee Harr
I have a database running 8.0.1 One of the tables uses a plpgsql function as a check constraint. There is data in the table that passed the constraint. The problem comes when trying to restore the database using a file created by pg_dump. Some of the data required by the check function is being

Re: [GENERAL] user/groups query ?

2005-06-19 Thread John DeSoi
On Jun 19, 2005, at 3:56 PM, Zlatko Matić wrote:   How to make a query that will include information both about user and group (or groups) he belongs to ? Thanks. Turning on the ECHO_HIDDEN feature in psql shows how to do this. \set ECHO_HIDDEN 1 \du user1 * QUERY ** SELEC

Re: [GENERAL] Insert behavior in transaction

2005-06-19 Thread Andres
But, does it have solution ?? You are right, the second insert imply a unique-key violation, but what to do in that cases? Thanks for your help and attention! Tom Lane writes: > "Andres" <[EMAIL PROTECTED]> writes: >> I did this simple test and it fails too. > >> BEGIN (first transaction) >>

Re: [GENERAL] plpgsql constraint checked data fails to restore

2005-06-19 Thread Michael Fuhr
On Mon, Jun 20, 2005 at 05:49:05AM +0430, Lee Harr wrote: > > I have a database running 8.0.1 > > One of the tables uses a plpgsql function as a > check constraint. There is data in the table that > passed the constraint. > > The problem comes when trying to restore the > database using a file cr