Re: [SQL] How to query by column names

2007-01-22 Thread Josh Williams
From: Jeff Frost <[EMAIL PROTECTED]> > On Mon, 22 Jan 2007, Richard Ray wrote: ... > > #!/bin/bash > > CMD="psql -d test \"select * from t1\"" > > echo $CMD >> my_log > > eval $CMD | > > while read x; do > > do_something_with_x > > done > > > > In this example * expands to all files in the current

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
On Tue, 23 Jan 2007, Josh Williams wrote: From: Jeff Frost <[EMAIL PROTECTED]> On Mon, 22 Jan 2007, Richard Ray wrote: ... That's definitely part of it. I'm assuming the above is an abridged example and the OP is doing something dynamic with the query. The real trouble is Bash likes to ex

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
On Mon, 22 Jan 2007, Richard Ray wrote: On Mon, 22 Jan 2007, Jeff Frost wrote: So why are you avoiding "SELECT * FROM t1;" ? I was affeared that if I brought my total ignorance to light I would be band from the list but here goes. I work in UNIX/Linux environments. It's my habit to record m

Re: [SQL] How to query by column names

2007-01-22 Thread Richard Ray
On Mon, 22 Jan 2007, Jeff Frost wrote: So why are you avoiding "SELECT * FROM t1;" ? I was affeared that if I brought my total ignorance to light I would be band from the list but here goes. I work in UNIX/Linux environments. It's my habit to record my scripts. A simple example: #!/bin/bash

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
So why are you avoiding "SELECT * FROM t1;" ? You'd probably also be happier using information_schema to get the column names. On Mon, 22 Jan 2007, Richard Ray wrote: All attributes of t1 Where (select attname from pg_attribute where attrelid = (select relfilenode from pg_class where relnam

Re: [SQL] How to query by column names

2007-01-22 Thread Richard Ray
All attributes of t1 Where (select attname from pg_attribute where attrelid = (select relfilenode from pg_class where relname = 't1') and attisdropped = false and attnum > 0) is a substitute for * On Mon, 22 Jan 2007, Jeff Frost wrote: Perhaps I should have asked this earlier. What informatio

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
Perhaps I should have asked this earlier. What information are you trying to extract? On Mon, 22 Jan 2007, Richard Ray wrote: This is not exactly what I need I want to return the data in t1 On Mon, 22 Jan 2007, Jeff Frost wrote: I think this is what you're looking for Richard: SELECT attn

Re: [SQL] How to query by column names

2007-01-22 Thread Richard Ray
This is not exactly what I need I want to return the data in t1 On Mon, 22 Jan 2007, Jeff Frost wrote: I think this is what you're looking for Richard: SELECT attname FROM pg_attribute pa, pg_class pc WHERE pc.relname = 't1' AND pa.attrelid = pc.relfilenode AND pa.attisdropped IS FALSE

Re: [SQL] How to query by column names

2007-01-22 Thread Jeff Frost
I think this is what you're looking for Richard: SELECT attname FROM pg_attribute pa, pg_class pc WHERE pc.relname = 't1' AND pa.attrelid = pc.relfilenode AND pa.attisdropped IS FALSE AND pa.attnum > 0; Let me know if it doesn't do what you intended. On Mon, 22 Jan 2007, Richard R

[SQL] How to query by column names

2007-01-22 Thread Richard Ray
This may be a simple but can I create a query such as select (select attname from pg_attribute where attrelid = (select relfilenode from pg_class where relname = 't1') and attisdropped = false and attnum > 0) from t1; I get ERROR: more than one row returned by a subquery used as an expressio

Re: [SQL] Schema sample

2007-01-22 Thread Aaron Bono
On 1/22/07, Marcin Stępnicki <[EMAIL PROTECTED]> wrote: Dnia Mon, 22 Jan 2007 17:38:09 -0200, Ezequias Rodrigues da Rocha napisał(a): > Hi list, > > I would like to ask you if there is any schema that someone can send me. I > must make some Replication testes and would like to use a simple sche

Re: [SQL] Schema sample

2007-01-22 Thread Marcin Stępnicki
Dnia Mon, 22 Jan 2007 17:38:09 -0200, Ezequias Rodrigues da Rocha napisał(a): > Hi list, > > I would like to ask you if there is any schema that someone can send me. I > must make some Replication testes and would like to use a simple schema > with two or three tables would be nice. You can find

[SQL] Schema sample

2007-01-22 Thread Ezequias Rodrigues da Rocha
Hi list, I would like to ask you if there is any schema that someone can send me. I must make some Replication testes and would like to use a simple schema with two or three tables would be nice. My best regards... -- =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

FW: [SQL] Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS?

2007-01-22 Thread Simon Kinsella
That sounds like a plan - will give it a go. Thanks! simon -Original Message- From: Tom Lane [mailto:[EMAIL PROTECTED] Sent: Monday, January 22, 2007 3:37 AM To: Simon Kinsella Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] Possible to emulate pre-8.2 behaviour of SET CONSTRAINTS? "S

Re: [SQL] list variable attributes in one select

2007-01-22 Thread A. Kretschmer
am Mon, dem 22.01.2007, um 8:43:48 +0100 mailte Louis-David Mitterrand folgendes: > "person_type" contains differents caracteristics for a person (actor, > director, author, etc.) who can have several types, hence the need for > the person_to_type table. > > I'd like to know if I can list in