Re: [SQL] Job control in sql

2012-05-29 Thread Svenne Krap
On 29-05-2012 12:32, Ireneusz Pluta wrote: > W dniu 2012-05-25 10:28, Svenne Krap pisze: >> Hi. >> >> I am building a system, where we have jobs that run at different >> times (and takes widely different lengths of time). >> >> Basically I have a jobs tab

[SQL] Job control in sql

2012-05-25 Thread Svenne Krap
Hi. I am building a system, where we have jobs that run at different times (and takes widely different lengths of time). Basically I have a jobs table: create table jobs( id serial, ready boolean, job_begun timestamptz, job_done timestamptz, primary key (id) ); This should

Re: [SQL] Multiple recursive part possible?

2011-05-01 Thread Svenne Krap
On 02-05-2011 00:12, Tom Lane wrote: > Leave out the second "with recursive". WITH introduces a list of > name-AS-subselect clauses, not just one. > Thanks :) Svenne -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mai

[SQL] Multiple recursive part possible?

2011-05-01 Thread Svenne Krap
Hi. I just tried to make a query that traverses a tree upwards to locate the root and then downwards to locate all branches on PGSQL 9.0. The two recursive parts seems to do the right thing each on its own, but together i get an error... ERROR: syntax error at or near "with recursive" LINE 6:

[SQL] Cascading sum in tree with CTE?

2010-04-09 Thread Svenne Krap
Hi . My problem resembles this: I have the following (simplified) tables 1) create table account ( id serial, name varchar, parent_id int4 references account, primary key (id)) 2) create table transaction (id serial, account_id int4 references account, memo varchar, debet, credit, primary key(i

[SQL] Foreign key columns

2009-11-05 Thread Svenne Krap
Hi. Is there a simple way to get foreign key data... for example I found a view, that does what I want ... It delivers fk_table | fk_column | pk_table | pk_column | constraint_name --++---+---+

Re: [SQL] How to call table returning function with other table

2006-03-19 Thread Svenne Krap
Perfect. Thanks. Svenne Markus Bertheau wrote: 2006/3/19, Svenne Krap <[EMAIL PROTECTED]>: So it is something like "select xxx(id) from othertable where otherwhere = 't'" except that it mangles the columns into an array. I have tried to move the funct

[SQL] How to call table returning function with other table

2006-03-19 Thread Svenne Krap
Hi. I have a function that is defined like (which works, sorry for the pseudocode) create type xxx as (id,...); create function calcuate_xxx (integer) returns xxx as $$ select $1, (select sum(amount) from bigtable where something) as a, (select sum(amount) from bigtable where some-other-thing

Re: [SQL] Database structure

2004-05-04 Thread Svenne Krap
I would definately say solution two. As you point out yourself, there are only for int4s (propably even int2s), that is 8 bytes each for the int4 (if I remeber corretly), which equals something in the 40-50 bytes range for the row w/o index. For 15m rows, thats not much more than 750 megabytes wi

[SQL] Subselects, the Oracle way

2001-06-18 Thread Svenne Krap
Hi, Is there any way to mimic the oracle way of subselect, especially constructs like select * from (select col1 as x, col2, col6 from t1 union select col2 as x, col6, col2 from t2) y order by y.x I am aware of the fact, that it is possible to accomplish through the use of tempoary tables,