[GENERAL] How-to question: pre-parsing and pre-planning dynamic sql statements

2010-08-11 Thread Davor J.
Suppose you have a table CREATE TABLE tbl_formulas (formula_id integer, formula text) The formula field can be any postgres-supported mathematical operation which references some input data with $1 like "sin($1) + cos($1)" and returns one numeric value. Such formulas should be used in the SELEC

Re: [GENERAL] Partitioning into thousands of tables?

2010-08-10 Thread Davor J.
"Data Growth Pty Ltd" wrote in message news:aanlktimzaio+7mtur=sx0jcqwu7uk+_xznudl4qrm...@mail.gmail.com... I have a table of around 200 million rows, occupying around 50G of disk. It is slow to write, so I would like to partition it better. Have you actually tested this? Why do you expect a

Re: [GENERAL] Inheritance and trigger/FK propagation

2010-07-29 Thread Davor J.
"Karsten Hilbert" wrote in message news:20100728182051.gj2...@hermes.hilbert.loc... > On Tue, Jul 27, 2010 at 10:33:19AM +0200, Davor J. wrote: > >> Well... I found it out the hard way :). There are some extra caveats I >> have >> come along. There is the

Re: [GENERAL] Inheritance and trigger/FK propagation

2010-07-27 Thread Davor J.
"Craig Ringer" wrote in message news:4c3ed37c.1070...@postnewspapers.com.au... > My understanding is that it's mostly an implementation limitation. In > other words, rather than any fundamental reason why it should not be > done, the issue is that nobody has gone and implemented it, tested it, >

Re: [GENERAL] Inheritance and trigger/FK propagation

2010-07-27 Thread Davor J.
""Karsten Hilbert"" wrote in message news:20100719182027.123...@gmx.net... >> On Thu, Jul 15, 2010 at 4:05 AM, Davor J. wrote: >> > It seems no secret that a child table will not fire a trigger defined >> > on >> > it's parent table. Va

[GENERAL] Inheritance and trigger/FK propagation

2010-07-15 Thread Davor J.
It seems no secret that a child table will not fire a trigger defined on it's parent table. Various posts comment on this. But nowhere could I find a reason for this. Now, I just wonder whether the people who request this are wrong in their assumption that a trigger should fire on the child tab

Re: [GENERAL] Extending postgres objects with attributes

2010-07-14 Thread Davor J.
"Craig Ringer" wrote in message news:4c33dc32.7080...@postnewspapers.com.au... > On 06/07/10 17:47, Davor J. wrote: >> Thanks Craig. >> >> I still find it a bit awkward that we have to use "priv check function"-s >> because we can't define tr

Re: [GENERAL] psql \dp equivalent or similar query?

2010-07-06 Thread Davor J.
Great option! Thanks Andreas ""A. Kretschmer"" wrote in message news:20100706093242.gd13...@a-kretschmer.de... > In response to Davor J. : >> I couldn't find it on the net. I also coudn't find any reference to it in >> the psql source? >>

Re: [GENERAL] Extending postgres objects with attributes

2010-07-06 Thread Davor J.
n system tables is allowed in MySQL. So, all this just leaves me wondering why this is not possible in Postgres. Regards, Davor "Craig Ringer" wrote in message news:4c313581.2060...@postnewspapers.com.au... > On 04/07/10 21:43, Davor J. wrote: > > >> PS using

[GENERAL] psql \dp equivalent or similar query?

2010-07-06 Thread Davor J.
I couldn't find it on the net. I also coudn't find any reference to it in the psql source? Anyone any suggestions? Regards, Davor -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Extending postgres objects with attributes

2010-07-04 Thread Davor J.
Several times I wanted to "extend" some of the postgres objects, like roles or functions. For example, sometimes you want to add extra attributes to roles, which are application dependent. Or sometimes you want to store functions and reference them in your custom tables, without losing referent

Re: [GENERAL] Optimizer: ranges and partial indices? Or use partitioning?

2010-06-21 Thread Davor J.
I have the same table as yours with potential to grow over 50 billion of records once operational. But our hardware is currently very limited (8GB RAM). I concur with Tom Lane about the fact that partial indexes aren't really an option, but what about partitioning? I read from the Postgres doc

[GENERAL] conditional rules VS 1 unconditional rule with multiple commands?

2010-05-27 Thread Davor J.
I just wonder whether the two are equivalent from user perspective: As far as I see, you can always rewrite a multi-command rule as a conditional rule and vice versa. Further more, Postgres seems to execute all the conditional rules, just as if it would execute all the commands in the one uncond

Re: [GENERAL] Advice on webbased database reporting

2010-04-14 Thread Davor J.
Thank you all for the nice suggestions! -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

[GENERAL] Advice on webbased database reporting

2010-04-02 Thread Davor J.
I need to make certain views from the database visible online (on our webpage) and I wonder if there is any reasonably quick solution for this that works with Postgres? At best, a query should be specified and the user should be able to select the layout on certain columns (like stepped, or out

[GENERAL] Emphasizing "current item" in subclass of QAbstractItemView

2010-03-30 Thread Davor J.
By default, there is some barely visible dotted rectangle around the QItemSelectionModel::currentIndex (). Has anyone suggestions how to change this efficiently. (i.e. I think adjusting the model data with setData() and Qt::FontRole or Qt::BackgroundRole or something similar isn't the right way

Re: [GENERAL] Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg?

2010-02-14 Thread Davor J.
Thank you for the link Andreas. It was helpfull, but still not quite what I need. Regards, Davor ""A. Kretschmer"" wrote in message news:20100212114635.gb25...@a-kretschmer.de... > In response to Davor J. : >> What I want is something similar to this: >>

Re: [GENERAL] Function that creates a custom table AND returns it = impossible in pg?

2010-02-12 Thread Davor J.
ner and is equivalent to SELECT * FROM f(). For example, EXECUTE FUNCTION function_name()... So... is there a grain of truth in all this? Regards, Davor "Davor J." wrote in message news:hl11bd$2fs...@news.hub.org... > What I want is something similar to this: > >

[GENERAL] Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg?

2010-02-12 Thread Davor J.
What I want is something similar to this: CREATE OR REPLACE FUNCTION f( /* "some args..." */) RETURNS text AS $BODY$ DECLARE ... BEGIN DROP TABLE IF EXISTS tbl_temp; CREATE TEMPORARY TABLE tbl_temp( -- "based on args..." ); WHILE INSERT INTO tbl_temp VALUES (/*"some values"*/); END

[GENERAL] Function that creates a custom table AND returns it = impossible in pg?

2010-02-12 Thread Davor J.
What I want is something similar to this: CREATE OR REPLACE FUNCTION f( /* "some args..." */) RETURNS SETOF RECORD AS $BODY$ DECLARE ... BEGIN DROP TABLE IF EXISTS tbl_temp; CREATE TEMPORARY TABLE tbl_temp( -- "based on args..." ); WHILE INSERT INTO tbl_temp VALUES (/*"some values"*/

Re: [GENERAL] Function that creates a custom (temporary) table AND returns a pointer to it = impossible in pg?

2010-02-12 Thread Davor J.
the results for planning of the outer query. This would imply a layered query planning/execution. I think this approach would seriously extend the possibilities of pg in a rather "object-oriented" way. Or am I wrong? Regards, Davor "Davor J." wrote in message news:hl1170

Re: [GENERAL] One column to multiple columns based on constraints?

2010-02-10 Thread Davor J.
Davor "John R Pierce" wrote in message news:4b72729d.7020...@hogranch.com... > Davor J. wrote: >> Let's say you have a table: >> CREATE TABLE t ( >> time date, >> data integer >> ) >> >> Suppose you want a new table that has columns similar

Re: [GENERAL] R: One column to multiple columns based on constraints?

2010-02-10 Thread Davor J.
ement? Can you write a procedure to this in multiple steps? BillR From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Davor J. Sent: February-09-10 2:02 PM To: pgsql-general@postgresql.org Subject: Re: [GENERAL] R: One column

Re: [GENERAL] R: One column to multiple columns based on constraints?

2010-02-09 Thread Davor J.
Crosstab is indeed very interesting. Thank you for the suggestion Vincenzo. regards Davor "Vincenzo Romano" wrote in message news:3eff28921002081133h4b0d7fabm96cc1bc08e579...@mail.gmail.com... Look for crosstab in the documentation. Il giorno 8 feb, 2010 8:21 p., &quo

[GENERAL] One column to multiple columns based on constraints?

2010-02-08 Thread Davor J.
Let's say you have a table: CREATE TABLE t ( time date, data integer ) Suppose you want a new table that has columns similar to the following: "(x.time, x.data, y.time, y.data, z.time, z.data)" where x.time, y.time and z.time columns are constrained (for example x.time >2007 AND x.time <2008, y

[GENERAL] Creating subsets on timestamp with modulo, date_trunc and ?suggestions?

2010-02-08 Thread Davor J.
A simple way I came up is to truncate the date. So if you have 2009-08-08, and you want a subset on month, then just truncate the day-part: 2009-08-00 on the whole column, and SELECT DISTINCT so you have a subset. You can use this subset then to join the dates, GROUP BY and aggregate An oth

Re: [GENERAL] Referencing to system catalog problem

2010-01-24 Thread Davor J.
Thank you Adrian. I apparently missed that post. Guess I will have to come up with an different approach. "Adrian Klaver" wrote in message news:201001231002.15874.adrian.kla...@gmail.com... > On Saturday 23 January 2010 6:15:36 am Davor J. wrote: >> I am logged in as superu

[GENERAL] Referencing to system catalog problem

2010-01-23 Thread Davor J.
I am logged in as superuser. I am trying to create something similar to this: Code: CREATE TABLE tbl_unit_convfunctions( unit_from integer REFERENCES tbl_units (unit_id), unit_to integer REFERENCES tbl_units (unit_id), proc_id oid REFERENCES pg_proc (oid) )but no matter what I refer to from pg_pr