Re: SQL subquery to supply table name?

Поиск
Список
Период
Сортировка
От Martijn van Oosterhout
Тема Re: SQL subquery to supply table name?
Дата
Msg-id 20020926234607.GA16768@svana.org
обсуждение исходный текст
Ответ на SQL subquery to supply table name?  (Scott Chapman <scott_list@mischko.com>)
Список pgsql-general
On Thu, Sep 26, 2002 at 04:04:14PM -0700, Scott Chapman wrote:
> I have a situation where a table contains table names.  I need to know if I
> can make a Postgresql query that will have a subquery which supplies the
> table name I want to deal with.  Can this be done?
>
> Something like this:
> select column from (select table_name from table2 where key=value) where
> key=value;

The answer is no. You may be able to fudge it by creating a plpgsql function
that builds the query on the fly but it will probably suck performance-wise.

Sounds like your database structure is not properly normalised.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

В списке pgsql-general по дате отправления:

Предыдущее
От: Doug McNaught
Дата:
Сообщение: Re: [HACKERS] Performance while loading data and indexing
Следующее
От: Scott Chapman
Дата:
Сообщение: Re: SQL subquery to supply table name?