On Wed, Jul 17, 2013 at 3:39 PM, John Smith wrote:
> guys,
>
> have to use legacy 8.1.
>
> i have 100,000 tables in a schema that need to be queried (optimizing this
> by combining them into one will have to wait).
>
> so my query goes like so:
>
>> execute 'select * from ' || tabname::regclass ||
On Jul 17, 2013, at 22:39, John Smith wrote:
> so my query goes like so:
>
> > execute 'select * from ' || tabname::regclass || ' where firstname =
> > "john"' into e;
Are those quotes around 'john' double-quotes (for identifiers) or double
single-quotes (for literals)?
They look like double
John Smith-54 wrote
> any help?
Sorry.
Its hard enough teaching people via e-mail let alone teaching them on an
unsupported version of PostgreSQL that has reduced functionality with
respect to function writing compared to the more recent versions.
You are going to need to some kind of "FOR" loo
david, you're right. i didn't realize it had to be executed inside a
function so now i'm trying this:
-- create function
create or replace function get_tables(sname varchar) returns record as $$
select tablename from pg_tables where schemaname = $1;
$$ language 'plpgsql';
-- query tables wher
John Smith wrote on 17.07.2013 22:39:
guys,
have to use legacy 8.1.
i have 100,000 tables in a schema that need to be queried (optimizing this by
combining them into one will have to wait).
so my query goes like so:
> execute 'select * from ' || tabname::regclass || ' where firstname = "joh
John Smith-54 wrote
> guys,
>
> have to use legacy 8.1.
>
> i have 100,000 tables in a schema that need to be queried (optimizing this
> by combining them into one will have to wait).
>
> so my query goes like so:
>
>> execute 'select * from ' || tabname::regclass || ' where firstname =
> "john
On 07/17/2013 02:39 PM, John Smith wrote:
guys,
have to use legacy 8.1.
i have 100,000 tables in a schema that need to be queried (optimizing
this by combining them into one will have to wait).
so my query goes like so:
> execute 'select * from ' || tabname::regclass || ' where firstname =
On 07/17/2013 02:39 PM, John Smith wrote:
guys,
have to use legacy 8.1.
i have 100,000 tables in a schema that need to be queried (optimizing
this by combining them into one will have to wait).
so my query goes like so:
> execute 'select * from ' || tabname::regclass || ' where firstname =
guys,
have to use legacy 8.1.
i have 100,000 tables in a schema that need to be queried (optimizing this
by combining them into one will have to wait).
so my query goes like so:
> execute 'select * from ' || tabname::regclass || ' where firstname =
"john"' into e;
but i am getting an error:
>
__
From: pgsql-general-ow...@postgresql.org on behalf of Jasen Betts
Sent: Sat 20-Jun-09 12:14 AM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] Dynamic table
On 2009-06-17, A B wrote:
>> Your problem is currently sounding very much like an exam question; you
>&
On 2009-06-17, A B wrote:
>> Your problem is currently sounding very much like an exam question; you
>> seem to be arbitrarily making decisions without showing any real data.
>> When you deal with real problems in the real world you're normally
>> making compromises when you model things and hence
> Your problem is currently sounding very much like an exam question; you
> seem to be arbitrarily making decisions without showing any real data.
> When you deal with real problems in the real world you're normally
> making compromises when you model things and hence the decisions
> wouldn't be as
On Jun 16, 2009, at 12:11 AM, A B wrote:
Hi.
I have a little problem (and a suggestion for a solution) that I
wondered if anyone would care to comment on.
I have a standard table filled with customers (with a unique customer
id, names etc.) and for each customer I need to store some integer
va
On Tue, Jun 16, 2009 at 01:21:42PM +0200, A B wrote:
> > The examples you gave (i.e. shoe size, hair length) would fit normal
> > table columns much better.
> Sorry, shoe size was not a good example, think of it as string> instead of shoe size. The data/name is nothing you can relate
> to in any
2009/6/16 A B :
>
> 2009/6/16 Greg Stark
>>
>> I don't think think it's fair to call this EAV actually. It sounds
>> like the integers are a collection of things which represent the same
>> thing. Ie, they're all bank balances or all distances driven, just for
>> different time periods. Storing al
2009/6/16 Greg Stark
> On Tue, Jun 16, 2009 at 12:21 PM, A B wrote:
>
> I don't think think it's fair to call this EAV actually. It sounds
> like the integers are a collection of things which represent the same
> thing. Ie, they're all bank balances or all distances driven, just for
> different
On Tue, Jun 16, 2009 at 12:21 PM, A B wrote:
>
>> Just had a quick flick through your previous posts; and I'd probably
>> stick with the multiple tables approach. It's the most natural fit to
>> relational databases and until you know more about the problem (i.e.
>> you've experienced the data you
> The way you described the problem the EAV solution sounds like the best
> match--not sure if I'd use your synthetic keys though, they will save a
> bit of space on disk but queries will be much more complicated to write.
I guess I'll have to build procedures for all the complicated queries
when e
On Tue, Jun 16, 2009 at 09:11:20AM +0200, A B wrote:
> I have a standard table filled with customers (with a unique customer
> id, names etc.) and for each customer I need to store some integer
> values. The problem is that the number of integer values that should
> be stored WILL change over time
Hi.
I have a little problem (and a suggestion for a solution) that I
wondered if anyone would care to comment on.
I have a standard table filled with customers (with a unique customer
id, names etc.) and for each customer I need to store some integer
values. The problem is that the number of integ
On Sat, Jun 23, 2007 at 09:43:01PM -0600, gary jefferson wrote:
> Is there a way to use a variable as the name of a table or column in
> plpgsql?
No, plpgsql is statically typed, it can't handle the possiblity of the
types of variables changing. Use a more dynamic
language(perl/tcl/python/etc...)
Is there a way to use a variable as the name of a table or column in plpgsql?
This might be a simple question, but I can't find the answer in the
docs. http://www.postgresql.org/docs/8.2/interactive/plpgsql-declarations.html
hints that there are data types that correspond to table/column, but I
ugh, I'm going down a rathole with this... the dynamic part of the
query is the table name, and therefore, if I want to select into a row
variable, that variable's declaration needs to be dynamic, too. That
seems kind of crazy, and I see no way to do that anyway. Maybe I'm
going about this all
Thanks Michael and Steve.
Related question: If I previously had a
IF EXISTS (select ...)
statement, and the 'select ...' part now needs to be run with EXECUTE,
how do I check for existence? It looks like I need to do an 'INTO'
with a row variable? I can't seem to find an example snippet of ho
On Jun 23, 2007, at 8:47 PM, gary jefferson wrote:
Is there a way to use a variable as the name of a table or column
in plpgsql?
This might be a simple question, but I can't find the answer in the
docs. http://www.postgresql.org/docs/8.2/interactive/plpgsql-
declarations.html
hints that t
On Jun 23, 2007, at 22:47 , gary jefferson wrote:
Is there a way to use a variable as the name of a table or column
in plpgsql?
AIUI, you need to use EXECUTE and build the query string yourself.
http://www.postgresql.org/docs/8.2/interactive/plpgsql-
statements.html#PLPGSQL-STATEMENTS-EXEC
Is there a way to use a variable as the name of a table or column in plpgsql?
This might be a simple question, but I can't find the answer in the
docs. http://www.postgresql.org/docs/8.2/interactive/plpgsql-declarations.html
hints that there are data types that correspond to table/column, but I
Thank you very much.
Much appreciated.
NK
- Original Message -
From: Bruno Wolff III <[EMAIL PROTECTED]>
Date: Friday, July 14, 2006 2:50 pm
Subject: Re: Dynamic table with variable number of columns
> On Wed, Jul 12, 2006 at 13:38:34 -0700,
> [EMAIL PROTECTED] wrote:
> > Hi,
> > Thanks
On Wed, Jul 12, 2006 at 13:38:34 -0700,
[EMAIL PROTECTED] wrote:
> Hi,
> Thanks again.
> One more question. Will crosstab function work if i will not know the
> number/names of columns before hand? Or I need to supply colum
> headings?
I checked a bit into this, and the actual contrib name is
Hi,
Thanks again.
One more question. Will crosstab function work if i will not know the
number/names of columns before hand? Or I need to supply colum
headings?
Thanks again.
NK
Bruno Wolff III wrote:
> On Wed, Jul 12, 2006 at 07:08:15 -0700,
> [EMAIL PROTECTED] wrote:
> >
> > Thank you for t
Hi Thomas,
No I actually need the product name (prod1, prod2) to become column headings, which is effectively transposing the table.
Thanks.
NK
- Original Message -
From: Thomas Burdairon <[EMAIL PROTECTED]>
Date: Wednesday, July 12, 2006 10:53 am
Subject: Re: [GENERAL] Dynamic
Hi Thomas,
No I actually need the product name (prod1, prod2) to become column
headings, which is effectively transposing the table.
Thanks.
NK
Thomas Burdairon wrote:
> if i understand well you need to have an history for your products.
> i would have a table B with
> date produ
On Wed, Jul 12, 2006 at 07:08:15 -0700,
[EMAIL PROTECTED] wrote:
>
> Thank you for the suggestions.
> I will try to describe the problem better.
> I have two problems to solve. First one is that I have to transpose a
> table.
> I have table A that looks like this:
> date product price
if i understand well you need to have an history for your products.i would have a table B withdate products price1/1/2006 prod1 1.01/1/2006 prod2 3.0or replace prod_name py product_id, ... Thomas On Jul 12, 2006, at 16:08, [EMAIL PROTEC
Bruno Wolff III wrote:
> On Tue, Jul 11, 2006 at 06:05:18 -0700,
> [EMAIL PROTECTED] wrote:
> > Hello,
> > I'm a pgsql novice and here is what I'm trying to do:
> > 1.I need to create a dynamic table with the column names fetched
> > from the database using a select statement from some other
On Tue, Jul 11, 2006 at 06:05:18 -0700,
[EMAIL PROTECTED] wrote:
> Hello,
> I'm a pgsql novice and here is what I'm trying to do:
> 1.I need to create a dynamic table with the column names fetched
> from the database using a select statement from some other table. Is
> it possible? Could yo
Hello,
I'm a pgsql novice and here is what I'm trying to do:
1.I need to create a dynamic table with the column names fetched
from the database using a select statement from some other table. Is
it possible? Could you point me to a simple example on how to do it?
2. I would like to compare
Thanks for pointing me in the right direction. I read
about EXECUTE in the docs now.
> Most of the other PLs don't cache query plans
> at all, and so all queries are effectively EXECUTE'd
> and there's no issue.
I'm not sure what you mean...
Is there a more suitable LANGUAGE declaration you
wo
Matthew Peter <[EMAIL PROTECTED]> writes:
> Out of curiosity, I was wondering if it is possible to
> use dynamic table names in a function?
In plpgsql, you can do this by building dynamic query strings and
EXECUTE'ing them. Most of the other PLs don't cache query plans
at all, and so all queries
On Sat, Oct 29, 2005 at 10:45:21 -0700,
Matthew Peter <[EMAIL PROTECTED]> wrote:
> Out of curiosity, I was wondering if it is possible to
> use dynamic table names in a function? AND whether or
> not you can test a value prior to insert to see
> whether or not you want to update that column. Wher
Out of curiosity, I was wondering if it is possible to
use dynamic table names in a function? AND whether or
not you can test a value prior to insert to see
whether or not you want to update that column. Where
you could pass in the name of the table for it use ANY
name passed in rather than statica
41 matches
Mail list logo