Re: select from dynamic table names

From: Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
To: Dinesh Kumara <dinesh(at)rezgateway(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: select from dynamic table names
Date: 2011-11-10 17:38:37
Message-ID: CAFj8pRCW6=Veziddff4ZGTZyPJnN7++upkSw9NRT5Th2=HUVYg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

2011/11/8 Dinesh Kumara <dinesh(at)rezgateway(dot)com>

> **
> I have 16 tables which created according to generated MD5 hash.
> At the time of execution i tried to retrieve data from a table where table
> name id dynamic.
>
> table name can be expertdb.rate_AVAIL_[0 to F]
>
> I tried to get this from ;
> SELECT * FROM expertdb.rate_AVAIL_ ||
> upper(substring(md5('2011-11-10')from 1 for 1))
>
> but it is giving an error that is error with '||' appender. please someone
> give me an idea..
>

you can't do it on SQL level - column and table names must be constant

Regards

Pavel Stehule

>
> --
>
> *Thanks and Regards,*
> Dinesh Kumara,
> Software Engineer,
> Reservation Gateway Inc,
> Email:dinesh(at)rezgateway(dot)com
> www.rezgateway.com
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message David Johnston 2011-11-10 18:05:54 Re: Returning a row from a function with an appended array field
Previous Message David Johnston 2011-11-10 17:37:04 Re: Re: plpgsql, I have a solution, want to see if there is a cleaner/better one. Taking vertical list and comma separating it onto a row