[GENERAL] Reduce the time to know trigger_fi​le's existence

2012-09-03 Thread Harshitha S
Hi, We are trying to introduce a thread that monitors the creation of the trigger_file. As and when the file is created, the process that monitors postgres server needs to be notified through the inotify API. This is to reduce the 3-4 seconds delay that exists with the current implementation in p

[GENERAL] Postgres not getting logged in from command prompt

2012-09-03 Thread Himanshu Joshi
Hi All, I am getting a below mentioned strange error while logging into postgres from linux command prompt. It is working fine with GUI(pgAdmin III). I am using postgres version 8.4SS. Himanshu # cd /opt/PostgresPlus/8.4SS/ # bin/psql -Upostgres -p bin/

[GENERAL] Reduce the time to know trigger_file's existence

2012-09-03 Thread togetinfo mail
Hi, We are trying to introduce a thread that monitors the creation of the trigger_file. As and when the file is created, the process that monitors postgres server needs to be notified through the inotify API. This is to reduce the 3-4 seconds delay that exists with the current implementation in p

Re: [GENERAL] Postgres not getting logged in from command prompt

2012-09-03 Thread Albe Laurenz
Himanshu Joshi wrote: > I am getting a below mentioned strange error while logging into > postgres from linux command prompt. It is working fine with GUI(pgAdmin > III). I am using postgres version 8.4SS. > Himanshu > # cd /opt/PostgresPlus/8.4SS/ > # bin/psql -Upostgres -p > bin/psql: line

[GENERAL] Re: [GENERAL] UPDATE RULE to be invoked when UPDATE .. WHERE fails the WHERE predicate ?‏

2012-09-03 Thread Dean Rasheed
On 2 September 2012 22:42, johnlumby wrote: > On 09/01/12 03:46, Dean Rasheed wrote: >> What you are trying to do cannot be achieved rules, and doing it this >> way with triggers is likely to be messy. I think you need to consider >> a different approach. >> >> It sounds like what you really want

Re: [GENERAL] Postgres not getting logged in from command prompt

2012-09-03 Thread Magnus Hagander
On Mon, Sep 3, 2012 at 10:10 AM, Albe Laurenz wrote: > Himanshu Joshi wrote: >> I am getting a below mentioned strange error while logging > into >> postgres from linux command prompt. It is working fine with > GUI(pgAdmin >> III). I am using postgres version 8.4SS. >> Himanshu >> # cd /op

[GENERAL] Create loop in postgresql

2012-09-03 Thread Robert Buckley
Hi, I am trying to loop through the records in a table and update a column. I can do this with a case statement but I would like to simplify this to a simple loop statement. I can´t seem to work out how to do it though. Here is the case statement. select name,ges_kw_zgb, case When name='Bad Ha

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread salah jubeh
I am wondering why do not you write it like this select name,ges_kw_zgb, select round(100 * (ges_kw_zgb / (select sum(ges_kw_zgb) From energie.tennet_auswertung_2010)),2) .. Regards From: Robert Buckley To: "pgsql-general@postgresql.org" Sent: Mond

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Rainer Pruy
And probably the op would prefer to avoid recalculating the sum once for every row. select name,ges_kw_zgb, round(100*ges_kw_zgb/total.totalsum, 2) as z from energie.tennet_auswertung_2010, (select sum(ges_kw_zgb) totalsum >From energie.tennet_auswertung_2010) as total where .. Regards R

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Rainer Pruy
Try it with parentheses around the (SELECT). On 03.09.2012 18:06, Robert Buckley wrote: > this give an error. > > select name,ges_kw_zgb, SELECT round(100 * (ges_kw_zgb / (select > sum(ges_kw_zgb) From energie.tennet_auswertung_2010)),2); > > ERROR: syntax error at or near "SELECT" > LINE 2:

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Robert Buckley
this give an error. select name,ges_kw_zgb, SELECT round(100 * (ges_kw_zgb / (select sum(ges_kw_zgb) From energie.tennet_auswertung_2010)),2); ERROR:  syntax error at or near "SELECT" LINE 2: select name,ges_kw_zgb, SELECT round(100 * (ges_kw_zgb / (se... Von

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread salah jubeh
Hello Robert, I just gave an example and this also can be optimized . but let me first clarify one thing here.   since you have the same behaviour for all values , there is no need to use case in the first place. So just drop it. I think below would be the correct syntax select name,ges_kw_z

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Raymond O'Donnell
On 03/09/2012 17:06, Robert Buckley wrote: > this give an error. > > select name,ges_kw_zgb, SELECT round(100 * (ges_kw_zgb / (select > sum(ges_kw_zgb) From energie.tennet_auswertung_2010)),2); > > ERROR: syntax error at or near "SELECT" LINE 2: select > name,ges_kw_zgb, SELECT round(100 * (ges

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Robert Buckley
Thanksthat worked a treat! cheers, Rob Von: salah jubeh An: Robert Buckley ; "pgsql-general@postgresql.org" Gesendet: 18:23 Montag, 3.September 2012 Betreff: Re: [GENERAL] Create loop in postgresql Hello Robert, I just gave an example and this also

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Robert Buckley
Now even stranger is that I can´t update a column with the query. Update energie.tennet_auswertung_2010 set "Test"=( SELECT round(100*ges_kw_zgb/total.totalsum, 2) from energie.tennet_auswertung_2010,  (select sum(ges_kw_zgb) totalsum From energie.tennet_auswertung_2010) as total ); ERROR:  mor

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Robert Buckley
This works ok  SELECT round(100 * (ges_kw_zgb / (select sum(ges_kw_zgb) From energie.tennet_auswertung_2010)),2) FROM energie.tennet_auswertung_2010 but this does not update energie.tennet_auswertung_2010 set "Test"= ( SELECT round(100 * (ges_kw_zgb / (select sum(ges_kw_zgb) From energie.tenne

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Raymond O'Donnell
On 03/09/2012 18:30, Robert Buckley wrote: > Now even stranger is that I can´t update a column with the query. > > Update energie.tennet_auswertung_2010 set "Test"=( > > SELECT round(100*ges_kw_zgb/total.totalsum, 2) from > energie.tennet_auswertung_2010, > (select sum(ges_kw_zgb) totalsum From

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread salah jubeh
Hello Rob, there are many ways to do this task. This way is not optimal but any way mimic the example below and you will get it  CREATE TABLE test_update (   id integer NOT NULL,   "value" numeric,   percentage numeric,   CONSTRAINT test_update_pkey PRIMARY KEY (id) ) WITH (   OIDS=FALSE ); ins

Re: [GENERAL] Create loop in postgresql

2012-09-03 Thread Raymond O'Donnell
On 03/09/2012 18:42, Robert Buckley wrote: > This works ok > SELECT round(100 * (ges_kw_zgb / (select sum(ges_kw_zgb) From > energie.tennet_auswertung_2010)),2) FROM energie.tennet_auswertung_2010 > > but this does not > > update energie.tennet_auswertung_2010 set "Test"= > ( > SELECT round(100

Re: [GENERAL] "Too far out of the mainstream"

2012-09-03 Thread Geert Mak
I have been looking into heroku lately, they run on PostgreSQL - https://postgres.heroku.com/postgres -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] Reduce the time to know trigger_fi​le's existence

2012-09-03 Thread Craig Ringer
On 09/03/2012 04:30 PM, Harshitha S wrote: Hi, We are trying to introduce a thread that monitors the creation of the trigger_file. As and when the file is created, the process that monitors postgres server needs to be notified through the inotify API. File system notification APIs aren't portab

Re: [GENERAL] Reduce the time to know trigger_fi​le's existence

2012-09-03 Thread Craig Ringer
On 09/03/2012 04:30 PM, Harshitha S wrote: Hi, We are trying to introduce a thread that monitors the creation of the trigger_file. As and when the file is created, the process that monitors postgres server needs to be notified through the inotify API. File system notification APIs aren't portab

Re: [HACKERS] [GENERAL] Date conversion using day of week

2012-09-03 Thread Bruce Momjian
Patch applied. --- On Sat, Sep 1, 2012 at 05:14:39PM -0400, Bruce Momjian wrote: > [Properly posted to hackers list] > > On Fri, Apr 1, 2011 at 02:27:02AM +1100, Brendan Jurd wrote: > > On 1 April 2011 02:00, Adrian Klave

[GENERAL] Null-terminated log entries?

2012-09-03 Thread Chris Angelico
Sometimes it's handy to turn on really verbose Postgres logging, but then to filter the log. I've lately been using 'tail -F' to monitor the log, and then filtering with grep, utilizing log_line_prefix to distinguish our various applications (eg by username or application_name). The problem with th

Re: [GENERAL] "Too far out of the mainstream"

2012-09-03 Thread Gavin Flower
On 04/09/12 10:38, Geert Mak wrote: I have been looking into heroku lately, they run on PostgreSQL - https://postgres.heroku.com/postgres "PostgreSQL is the database of choice for reliable web-applications." Is what they say on that page, not mincing words are they? Cheers, Gavin -- Sen

[GENERAL] Re: [GENERAL] Reduce the time to know trigger_fi​le's existence

2012-09-03 Thread Harshitha S
Hi, Can Latch - that postgres already uses, be used to achieve the same? On Tue, Sep 4, 2012 at 6:31 AM, Craig Ringer wrote: > On 09/03/2012 04:30 PM, Harshitha S wrote: > >> Hi, >> We are trying to introduce a thread that monitors the creation of the >> trigger_file. As and when the file is cr

[GENERAL] recovering databases

2012-09-03 Thread Yvon Thoraval
on my computer I had a disk probleme, then i had to reinstall the system (Xubuntu 12.04). I've backuped some parts of the disk, namely /etc, /var and /home. I wonder if I'm able to recover my past databases in the /var/lib/postgresql/9.1/ backup. If yes, how ? -- Yvon