Re: [GENERAL] Re: Mapping output from a SEQUENCE into something non-repeating/colliding but random-looking?

2009-05-03 Thread Craig Ringer
Just to follow up on this with a look at check digit generation and checkin: Luhn's algorithm should do for the check digit, I think. It need not be anything complex given the chances for collision in the sample space. Additionally, it's commonly used, easily implemented and widely understood

Re: [GENERAL] Re: Mapping output from a SEQUENCE into something non-repeating/colliding but random-looking?

2009-05-03 Thread Alban Hertroys
On May 3, 2009, at 9:00 AM, Craig Ringer wrote: CREATE OR REPLACE FUNCTION luhn_verify(int8) RETURNS boolean AS $$ SELECT -- Add the digits, doubling odd-numbered digits (counting left with -- least significant as zero), and see if the sum is evenly -- divisible by zero. I think you

[GENERAL] windows service

2009-05-03 Thread garry
Anyone know how to install Postgresql as a windows service from the command line. I have this as the correct syntax: c:\scholarpack\postgres\bin\pg_ctl.exe runservice -w -N P4 -D c:\scholarpack\data Where P4 is the name of the service. However, I can not get the sc command to accept the above

[GENERAL] Rounding problems

2009-05-03 Thread Paolo Saudin
Hi, I have a problem with a query wich simple aggregate values. In the sample below I have two values, 1.3 and 1.4. Rounding their average with one decimals, should give 1.4. The first query with - cast( tables_seb.tbl_arvier_chamencon.id_1 AS numeric) AS value - give the expected result,

Re: [GENERAL] windows service

2009-05-03 Thread Thomas Kellerer
ga...@schoolteachers.co.uk wrote on 03.05.2009 13:32: Anyone know how to install Postgresql as a windows service from the command line. I have this as the correct syntax: c:\scholarpack\postgres\bin\pg_ctl.exe runservice -w -N P4 -D c:\scholarpack\data Where P4 is the name of the service.

Re: [GENERAL] windows service

2009-05-03 Thread Dave Page
On Sun, May 3, 2009 at 12:32 PM, ga...@schoolteachers.co.uk wrote: Anyone know how to install Postgresql as a windows service from the command line. I have this as the correct syntax: c:\scholarpack\postgres\bin\pg_ctl.exe runservice -w -N P4 -D c:\scholarpack\data Where P4 is the name of

[GENERAL] Server timestamp

2009-05-03 Thread Chris Bartlett
Date and time functions like current_time return the client machine's time. Is there a way of getting the database server's time? I have a situation that requires comparison of a date stamp on records with today, but I need to avoid the possibility of a user changing their computer's clock

Re: [GENERAL] Server timestamp

2009-05-03 Thread Scott Marlowe
On Sun, May 3, 2009 at 7:04 AM, Chris Bartlett c.bartl...@paradise.net.nz wrote: Date and time functions like current_time return the client machine's time. Is there a way of getting the database server's time? I have a situation that requires comparison of a date stamp on records with today,

Re: [GENERAL] Server timestamp

2009-05-03 Thread Craig Ringer
Chris Bartlett wrote: Date and time functions like current_time return the client machine's time. Er, no they don't. They return the server's time, adjusted to the client's time zone if the client specified its time zone using SET TIMEZONE. At least, that's how they behave here, and I can't

Re: [GENERAL] Rounding problems

2009-05-03 Thread Justin
Paolo Saudin wrote: Hi, I have a problem with a query wich simple aggregate values. In the sample below I have two values, 1.3 and 1.4. Rounding their average with one decimals, should give 1.4. The first query with - cast( tables_seb.tbl_arvier_chamencon.id_1 AS

Re: [GENERAL] Rounding problems

2009-05-03 Thread Tom Lane
Paolo Saudin pa...@ecometer.it writes: I have a problem with a query wich simple aggregate values. In the sample below I have two values, 1.3 and 1.4. Rounding their average with one decimals, should give 1.4. You seem way overoptimistic about float4 values being exact. They are not. The

R: [GENERAL] Rounding problems

2009-05-03 Thread Paolo Saudin
Paolo Saudin wrote: Hi, I have a problem with a query wich simple aggregate values. In the sample below I have two values, 1.3 and 1.4. Rounding their average with one decimals, should give 1.4. The first query with - cast( tables_seb.tbl_arvier_chamencon.id_1 AS numeric) AS value -

R: [GENERAL] Rounding problems

2009-05-03 Thread Paolo Saudin
Paolo Saudin pa...@ecometer.it writes: I have a problem with a query wich simple aggregate values. In the sample below I have two values, 1.3 and 1.4. Rounding their average with one decimals, should give 1.4. You seem way overoptimistic about float4 values being exact. They are not. The

[GENERAL] keeping track of function execution

2009-05-03 Thread Wojtek
Hi, I have a question on transactions/isolation levels/etc... In my PL/pgSQL function main loop goes through inventory list of active devices, for each one executing processing applicable for given device, like: FOR i in --i is %rowtype select device_id as device_id, type as type from

Re: [GENERAL] keeping track of function execution

2009-05-03 Thread David Rowley
Wojtek wrote: But... Postgress treats function as single transaction, of course. Hence, I'm not able to see any changes in my progress monitoring table until my main function is finished and all the statuses are set to 0. You could use dblink() to insert into your logging table. David. --

Re: [GENERAL] Difference between array column type and separate table

2009-05-03 Thread Ron Mayer
Alban Hertroys wrote: On May 2, 2009, at 9:33 AM, Mike Christensen wrote: ... create table Threads ( ... Tags int2[], ...); To me this seems cleaner, but I'm wondering about performance. If I had millions of threads, is a JOIN going to be faster? ... ...I don't think array values

Re: [GENERAL] keeping track of function execution

2009-05-03 Thread justin
Wojtek wrote: Hi, I have a question on transactions/isolation levels/etc... In my PL/pgSQL function main loop goes through inventory list of active devices, for each one executing processing applicable for given device, like: FOR i in --i is %rowtype select device_id as device_id, type

Re: [GENERAL] keeping track of function execution

2009-05-03 Thread Scott Marlowe
On Sun, May 3, 2009 at 9:38 AM, Wojtek f...@twine.pl wrote: Hi, I have a question on transactions/isolation levels/etc... In my PL/pgSQL function main loop goes through inventory list of active devices, for each one executing processing applicable for given device, like: FOR i in --i is

Re: [GENERAL] could not bind IPv4 socket

2009-05-03 Thread Grzegorz Buś
listen_addresses gets set to the IP address of the server itself, the IP address it is listening for input on. Since you're giving it a remote address, that's why it can't create a socket to listen there. There is a second file here, pg_hba.conf, that filters down who can connect to the

Re: [GENERAL] could not bind IPv4 socket

2009-05-03 Thread Adrian Klaver
On Sunday 03 May 2009 12:01:24 pm Grzegorz Buś wrote: listen_addresses gets set to the IP address of the server itself, the IP address it is listening for input on. Since you're giving it a remote address, that's why it can't create a socket to listen there. There is a second file here,

Re: [GENERAL] Online Backups PostGre (rsync for Windows)

2009-05-03 Thread Brent Wood
Hi There are a few rsync on Windows options, just google rsync windows One we've found works well is DeltaCopy, which may meet your requirements. Cheers, Brent Wood Brent Wood DBA/GIS consultant NIWA, Wellington New Zealand Adam Ruth adamr...@mac.com 05/02/09 1:01 PM Cygwin comes

Re: [GENERAL] windows service

2009-05-03 Thread Adam Ruth
One option is sc.exe command. sc create postgresql binPath= ^c:\scholarpack\postgres\bin \pg_ctl.exe^ runservice -w -N ^P4^ -D ^c:\scholarpack\data^ - start auto On 03/05/2009, at 9:32 PM, ga...@schoolteachers.co.uk wrote: Anyone know how to install Postgresql as a windows service from the

Re: [GENERAL] windows service

2009-05-03 Thread John R Pierce
Adam Ruth wrote: One option is sc.exe command. sc create postgresql binPath= ^c:\scholarpack\postgres\bin\pg_ctl.exe^ runservice -w -N ^P4^ -D ^c:\scholarpack\data^ -start auto except, on a SC CREATE, you'd need to specify a lot more than just the binpath. I'd suspect at least obj=

Re: [GENERAL] Tracking down a deadlock

2009-05-03 Thread Bill Moseley
On Sat, May 02, 2009 at 11:48:21AM -0400, Tom Lane wrote: Bill Moseley mose...@hank.org writes: Not getting any nibbles, so allow me to try a short question: If I have a deadlock situation (that will be reported as such by Postgresql once the deadlock_timeout passes), does pg_stat_activity

Re: [GENERAL] Tracking down a deadlock

2009-05-03 Thread Tom Lane
Bill Moseley mose...@hank.org writes: Then when I run the test script (which runs the same transaction in two processes at the same time) and get a deadlock the same query is shown twice both with waiting set true: UPDATE account set foo = 123 where id = $1 And if I remove that

Re: [GENERAL] Online Backups PostGre

2009-05-03 Thread PostGre Newbie
Thanks everyone for replying. I will definitely try out the methods outlined. Thanks once again :) -- 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] Online Backups PostGre

2009-05-03 Thread PostGre Newbie
Thanks everyone for replying. I will definitely try out the methods outlined. Thanks once again :) -- 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] Tracking down a deadlock

2009-05-03 Thread Bill Moseley
On Sun, May 03, 2009 at 09:08:29PM -0400, Tom Lane wrote: There are no other updates to that account table in the transaction, so I'm confused how that is causing a deadlock. Is there more than one row with the target id? No. It's a single SERIAL primary key. Does the account table