Re: [SQL] Job control in sql

2012-05-29 Thread Ireneusz Pluta
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 table: create table jobs( id serial, ready boolean, job_begun timestamptz, job_done ti

Re: [SQL] Job control in sql

2012-05-29 Thread Ireneusz Pluta
W dniu 2012-05-25 14:52, Jan Lentfer pisze: Add a sort of status table where you insert your unique job identifer at the start of the function and remove it in the end? As seperate transactions of course. That might leave status set on forever in a case when a job crashes and does not reach th

Re: [SQL] Average of Array?

2010-06-25 Thread Ireneusz Pluta
Lee Hachadoorian pisze: Is there a function that returns the average of the elements of an array? I'm thinking of something that would work like the avg() aggregate function where it returns the average of all non-NULL values. Can't find anything like it in the docs, and I'd like to make sure I'm

Re: [SQL] Week to date function

2010-03-27 Thread Ireneusz Pluta
Jorge Godoy pisze: Are you sure? http://en.wikipedia.org/wiki/ISO_8601 snip As Jan 1st, 2010 happened on a Friday, it was on week 53 of 2009. you are right, thanks for pointing that out. I didn't check the opposite way like this: select date_part('week', '2010-01-01'::date); date_part

Re: [SQL] Week to date function

2010-03-26 Thread Ireneusz Pluta
Sergey Konoplev pisze: CREATE OR REPLACE FUNCTION your_week2date(double precision, double precision) RETURNS SETOF date AS $_$ SELECT day FROM ( SELECT ( date_trunc('week', ($1::text||'-01-01')::date) + ($2::text||' week')::interval + ( d::text||' da

Re: [SQL] Week to date function

2010-03-26 Thread Ireneusz Pluta
Sergey Konoplev pisze: On 25 March 2010 12:25, Ireneusz Pluta wrote: Hello, is there any standard function, or a concise solution based on set of them, returning a set of dates included in a week of given year and week number? I ended up with creating my own function as in the example

[SQL] Week to date function

2010-03-25 Thread Ireneusz Pluta
Hello, is there any standard function, or a concise solution based on set of them, returning a set of dates included in a week of given year and week number? I ended up with creating my own function as in the example below, but I am curious if I am not opening an open door. Thanks Irek. C

Re: [SQL] Clarification With Money data type

2010-03-12 Thread Ireneusz Pluta
it's better to use some sort of numeric or integer and store amounts of cents, not dollars.

Re: [SQL] Insert into and Sequence

2007-12-19 Thread Ireneusz Pluta
Apparently, new records are not inserted in the table according to the order selected by "Test_Step_Id" field; As seen in: http://en.wikipedia.org/wiki/SQL: "The order of rows returned by an SQL query is never guaranteed unless an ORDER BY clause is specified". In other words, a databas

Re: [SQL] simple SQL question

2007-06-25 Thread Ireneusz Pluta
Joshua napisał(a): I have a column with the following values (example below) 5673 4731 4462 5422 756 3060 I want the column to display the numbers as follows: 56.73 47.31 44.62 54.22 7.56 30.60 I have been playing around with string functions but cannot seem to figure out a quick solution.

Re: [SQL] show index from [table]

2007-06-08 Thread Ireneusz Pluta
Andreas Kretschmer napisał(a): Yes, right. but actually i would need the information from within a (postgres) sql-query. is there a possibility to get information about the indices which have been created on a table? Yes, of corse. Please start psql with the -E - option. Now you can

Re: [SQL] insert a sequence

2007-05-11 Thread Ireneusz Pluta
ivan marchesini napisał(a): Dear postgres Users, I have a simple question I think. I have a table that contains some columns one of these columns (the columns ID) contains distinct integer values ... I need to insert into this table some other records but I only need that values were inserted int