Re: [SQL] Locating ( FKs ) References to a Primary Key

2005-08-17 Thread Roger Tannous
Dmitri, Thanks !! I got exactly what I wanted :) In fact, I used your query like this: SELECT cl.relname AS FK_table_name, a.attname AS FK_column_name, clf.relname AS PK_table_name, af.attname AS PK_column_name FROM pg_catalog.pg_attribute a JOIN pg_catalog.pg_

Re: [SQL] How to secure PostgreSQL Data for distribute?

2005-08-17 Thread Chris Travers
Premsun Choltanwanich wrote: Dear All, I need to distribute my application that use PostgreSQL as database to my customer. But I still have some questions in my mind on database security. I understand that everybody who get my application database will be have a full control permissio

Re: [SQL] How to secure PostgreSQL Data for distribute?

2005-08-17 Thread Kenneth Gonsalves
On Thursday 18 Aug 2005 8:26 am, Premsun Choltanwanich wrote: > Dear All, > > I need to distribute my application that use PostgreSQL as > database to my customer. But I still have some questions in my mind > on database security. I understand that everybody who get my > application database

Re: [SQL] How to secure PostgreSQL Data for distribute?

2005-08-17 Thread Pascual De Ruvo
On 8/17/05, Premsun Choltanwanich <[EMAIL PROTECTED]> wrote: > > Dear All, > > I need to distribute my application that use PostgreSQL as database to > my customer. But I still have some questions in my mind on database > security. I understand that everybody who get my application data

[SQL] How to secure PostgreSQL Data for distribute?

2005-08-17 Thread Premsun Choltanwanich
Dear All,   I need to distribute my application that use PostgreSQL as database to my customer. But I still have some questions in my mind on database security. I understand that everybody  who get my application database will be have a full control permission on my database in case that Pos

Re: [SQL] Is it This Join Condition Do-Able? Ooh, ouch, blush

2005-08-17 Thread Mischa Sandberg
The Subject says it all. (author beats a hasty retreat). Quoting Dmitri Bichko <[EMAIL PROTECTED]>: > I don't see what the problem is. > Did you mean to insert (3,'C3') into table c, rather than b? > > create temp table a(keyf int, val text); > > create temp table b(keyf int, val text); > > crea

Re: [SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Tom Lane
Mischa Sandberg <[EMAIL PROTECTED]> writes: > Anyone care to comment on the third row of output? I think you mistyped the last INSERT: > insert into c values(2, 'C2'); > insert into b values(3, 'C3'); I suppose you meant insert into c ... regards, tom lane -

Re: [SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Mischa Sandberg
Quoting Dmitri Bichko <[EMAIL PROTECTED]>: > How about: > > SELECT a.keyfld, a.foo1, b.foo2, c.foo3 > FROM a > LEFT JOIN b USING(keyfld) > LEFT JOIN c USING(keyfld) ((( See response at end ))) > > -Original Message- > > [mailto:[EMAIL PROTECTED] On Behalf Of Lane Van > Ingen > > Sent: W

Re: [SQL] Locating ( FKs ) References to a Primary Key

2005-08-17 Thread Dmitri Bichko
I have a couple of views I always add to 'information_schema' to help with these sorts of things. Here's the one for foreign keys: CREATE VIEW information_schema.foreign_key_tables AS SELECT n.nspname AS schema, cl.relname AS table_name, a.attname AS column_name, c

Re: [SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Dmitri Bichko
I don't see what the problem is. Did you mean to insert (3,'C3') into table c, rather than b? Dmitri > -Original Message- > From: Mischa Sandberg [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 17, 2005 3:31 PM > To: Dmitri Bichko > Cc: Lane Van Ingen; pgsql-sql@postgresql.org > Sub

[SQL] Locating ( FKs ) References to a Primary Key

2005-08-17 Thread Roger Motorola
Hi to all, Is there any means by which one can get all Foreign Keys (References) that 'point' to a certain Primary Key for a given table ? For instance, let's consider those three tables: (NOTE: table contents here are not deeply thought of...) // employees table create table emp (id serial pr

Re: [SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Jeremy Semeiks
On Wed, Aug 17, 2005 at 12:54:50PM -0400, Lane Van Ingen wrote: > Given three tables: a, b, c ; each consist of a 'keyfld' and a field called > 'foo': > tbl a tbl b tbl c >- - - >a.keyfldb.keyfld c.keyfld >a.foo1 b.foo2

Re: [despammed] [SQL] converting varchar to integer

2005-08-17 Thread A. Kretschmer
am 17.08.2005, um 12:46:01 -0400 mailte Frank Bax folgendes: > >>1) check the value in it is an integer > >>2) get the integer value (as integer) > >test=# update foo set n = substring(t , '[0-9]')::int; > > > I think you meant: > update foo set n = substring(t , '[0-9]+')::int;

Re: [SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Michael Fuhr
On Wed, Aug 17, 2005 at 12:54:50PM -0400, Lane Van Ingen wrote: > Given three tables: a, b, c ; each consist of a 'keyfld' and a field called > 'foo': > tbl a tbl b tbl c >- - - >a.keyfldb.keyfld c.keyfld >a.foo1 b.foo2

Re: [SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Dmitri Bichko
How about: SELECT a.keyfld, a.foo1, b.foo2, c.foo3 FROM a LEFT JOIN b USING(keyfld) LEFT JOIN c USING(keyfld) Dmitri > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Lane Van Ingen > Sent: Wednesday, August 17, 2005 12:55 PM > To: pgsql-sql@postgre

[SQL] Is it This Join Condition Do-Able?

2005-08-17 Thread Lane Van Ingen
Given three tables: a, b, c ; each consist of a 'keyfld' and a field called 'foo': tbl a tbl b tbl c - - - a.keyfldb.keyfld c.keyfld a.foo1 b.foo2 c.foo3 I want to always return all of tbl a; and I want to return b.fo

Re: [despammed] [SQL] converting varchar to integer

2005-08-17 Thread Frank Bax
At 05:30 AM 8/17/05, Kretschmer Andreas wrote: [EMAIL PROTECTED] <[EMAIL PROTECTED]> schrieb: > Hi, > >I have a varchar column, and I need to > >1) check the value in it is an integer >2) get the integer value (as integer) test=# update foo set n = substring(t , '[0-9]')::int; I

Re: [SQL] converting varchar to integer

2005-08-17 Thread Halley Pacheco de Oliveira
Using CASE to avoid '': CREATE TABLE test (number TEXT); INSERT INTO test VALUES('123'); INSERT INTO test VALUES('a123b'); INSERT INTO test VALUES(''); teste=> SELECT CASE number WHEN '' THEN NULL ELSE to_number(number,'990') END AS number FROM test;; number 123 123

Re: [despammed] [SQL] converting varchar to integer

2005-08-17 Thread Kretschmer Andreas
[EMAIL PROTECTED] <[EMAIL PROTECTED]> schrieb: > Hi, > >I have a varchar column, and I need to > >1) check the value in it is an integer >2) get the integer value (as integer) > >The problem is I can't suppose the're only correct >values - ie there can be something like 'xss