pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carlos Santos <carloscompels@yahoo.com.br>
To: Richard Huxton <dev@archonet.com>
Cc: Lista PostgreSQL SQL <pgsql-sql@postgresql.org>
Subject: Res: SELECT with WHERE clause by column number
Date: Mon, 18 Dec 2006 10:36:49 -0800 (PST)
Message-ID: <20061218183649.23058.qmail@web57105.mail.re3.yahoo.com> (raw)

All my columns have the same data type: text.
So it's much easier.
 
Carlos Henrique Iazzetti Santos 
Compels Informática 
 Santa Rita do Sapucaí - MG
www.compels.net


----- Mensagem original ----
De: Richard Huxton <dev@archonet.com>
Para: Carlos Santos <carlos@compels.net>
Cc: Lista PostgreSQL SQL <pgsql-sql@postgresql.org>
Enviadas: Segunda-feira, 18 de Dezembro de 2006 15:25:27
Assunto: Re: [SQL] SELECT with WHERE clause by column number

Carlos Santos wrote:
> SELECT id FROM myTable WHERE column-number = 'value';
> (PS: The id column is the primary key of myTable).
> 
> That is a select using column number in the WHERE clause what don't exists in SQL.
> 
> I need this because there's a situation in my program where I don't have the column name.
> I've solved that querying Postgresql the name of the column with that number, and then creating  the SELECT query.
> But this solution is slow... two database calls...

If you don't know what the column is, how do you know what you are 
testing against? Or what type it is, for that matter?

Anyway, just have build a list of column-name,column-type pairs for 
relevant tables at application start-up, or store it in a configuration 
file. Unless you're building/changing tables all the time, that should work.

I'm curious as to what type of application can usefuly query a database 
without knowing what structure it has.

-- 
   Richard Huxton
   Archonet Ltd

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

               http://archives.postgresql.org







		
_______________________________________________________ 
Yahoo! Acesso Grátis - Internet rápida e grátis. Instale 
o discador agora! 
http://br.acesso.yahoo.com

Message-ID: <20061218183649.23058.qmail@web57105.mail.re3.yahoo.com>
Permalink:  ../20061218183649.23058.qmail@web57105.mail.re3.yahoo.com/
Also on:    postgresql.org/message-id/20061218183649.23058.qmail@web57105.mail.re3.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: carloscompels@yahoo.com.br, dev@archonet.com
  Subject: Re: Res: SELECT with WHERE clause by column number
  In-Reply-To: <20061218183649.23058.qmail@web57105.mail.re3.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox