Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Rafal Pietrak
On Mon, 2012-07-16 at 14:08 -0400, David Johnston wrote: [] > > Specific, but unknown (e.g., day of week, month, year, etc...) results could > return "NaN" though "NULL" is also, probably more, reasonable given the > context. > > The goal would be to use "Infinity" in case where "<>"

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Tom Lane
Daniele Varrazzo writes: > This suggests me that the PG histogram doesn't count the occurrence > into bins of the same size over the domain, but instead records the > boundaries on the domain of bins containing the same amount of data. Right. I don't believe the PG planner has any issues with in

Re: [GENERAL] Create stored procedure from C#.net

2012-07-16 Thread Chris Travers
On Mon, Jul 16, 2012 at 1:29 PM, Brar Piening wrote: > > Something like PL/C# to write functions in C# doesn't exist. > > There used to be a PL/Mono, but don't know how well maintained it is. Best Wishes, Chris Travers

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Jeff Davis
On Mon, 2012-07-16 at 13:41 +0200, Alban Hertroys wrote: > >> BTW, that second value looks a whole lot like a poorly thought out > >> substitute for 'infinity' ... > >> regards, tom lane > > > > That's certainly an interesting comment and I'm open to suggestions! The > > ori

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Daniele Varrazzo
On Mon, Jul 16, 2012 at 10:30 PM, Chris Bartlett wrote: > At 8:35 PM +0100 16/7/12, Daniele Varrazzo wrote: >> >> Even without this quirk, the problem of mapping timestamps to other >> languages data types could be an even stronger design factor. I've >> personally settled for -12-31 which is

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Michael Nolan
On 7/16/12, Steven Schlansker wrote: > I think it's pretty easy to show that timestamp+size isn't good enough to do > this 100% reliably. That may not be a problem if the slave server synchronization code always starts to play back WAL entries at a time before the worst case for timestamp precisi

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread John R Pierce
On 07/16/12 2:42 PM, Chris Angelico wrote: On Tue, Jul 17, 2012 at 4:35 AM, Sergey Konoplev wrote: >I wonder if it is correct in general to use mtime and size to perform >these checks from the point of view of PostgreSQL. > >If it works with the current version then is there a guaranty that it

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Steven Schlansker
I think it's pretty easy to show that timestamp+size isn't good enough to do this 100% reliably. Imagine that your timestamps have a millisecond resolution. I assume this will vary based on OS / filesystem, but the point remains the same no matter what size it is. You can have multiple writes

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Chris Angelico
On Tue, Jul 17, 2012 at 4:35 AM, Sergey Konoplev wrote: > On Mon, Jul 16, 2012 at 8:01 PM, Chris Angelico wrote: >> On Tue, Jul 17, 2012 at 1:58 AM, Michael Nolan wrote: >>> As I understand the docs for rsync, it will use both mod time and file size >>> if told not to do checksums. > > I wonder

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Chris Bartlett
At 8:35 PM +0100 16/7/12, Daniele Varrazzo wrote: Even without this quirk, the problem of mapping timestamps to other languages data types could be an even stronger design factor. I've personally settled for -12-31 which is python's datetime.max, maps ok to doubles and won't create problems f

Re: [GENERAL] Create stored procedure from C#.net

2012-07-16 Thread Brar Piening
postgresuser wrote: I am using PostgreSql 8.3 version. I want to create stored procedure from C#.net. Is it possible? Any idea. You probably don't mean something like: using Npgsql; ... using (NpgsqlConnection connection = new NpgsqlConnection("Server=127.0.0.1;Database=postgres;Integrated S

Re: [GENERAL] How do write schema independent install files for functions.

2012-07-16 Thread Philip Couling
On 16/07/2012 20:44, Tom Lane wrote: > Philip Couling writes: >> I have a number of functions which I wish to wrap up in a SQL script >> (well technically DDL script). The functions reference one another and >> for safety it is necessary for them to ether set the search_path or >> directly refere

Re: [GENERAL] How do write schema independent install files for functions.

2012-07-16 Thread Bartosz Dmytrak
2012/7/16 Philip Couling > > Is there any more flexible way to do this? > > Hi, in my opinion you should use fully qualified names instead of set search_path Your script should look like this: CREATE OR REPLACE FUNCTION my_schema.foo() RETURNS INTEGER AS $BODY$ BEGIN RETURN 42; END; $

Re: [GENERAL] How do write schema independent install files for functions.

2012-07-16 Thread Tom Lane
Philip Couling writes: > I have a number of functions which I wish to wrap up in a SQL script > (well technically DDL script). The functions reference one another and > for safety it is necessary for them to ether set the search_path or > directly reference the schema for one another. > I was wo

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Daniele Varrazzo
On Mon, Jul 16, 2012 at 7:08 PM, David Johnston wrote: > Given: > A) extract() returns a "double precision" > B) "... In addition to ordinary numeric values, the floating-point types > have several special values: ... 'Infinity ..." > > I would vote that the epoch result should be "Infinity". Th

[GENERAL] How do write schema independent install files for functions.

2012-07-16 Thread Philip Couling
Hi I have a number of functions which I wish to wrap up in a SQL script (well technically DDL script). The functions reference one another and for safety it is necessary for them to ether set the search_path or directly reference the schema for one another. I was wondering if there is good / rec

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Michael Nolan
On 7/16/12, Sergey Konoplev wrote: > On Mon, Jul 16, 2012 at 8:01 PM, Chris Angelico wrote: >> On Tue, Jul 17, 2012 at 1:58 AM, Michael Nolan wrote: >>> As I understand the docs for rsync, it will use both mod time and file >>> size >>> if told not to do checksums. > > I wonder if it is correct

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Sergey Konoplev
On Mon, Jul 16, 2012 at 8:01 PM, Chris Angelico wrote: > On Tue, Jul 17, 2012 at 1:58 AM, Michael Nolan wrote: >> As I understand the docs for rsync, it will use both mod time and file size >> if told not to do checksums. I wonder if it is correct in general to use mtime and size to perform thes

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread David Johnston
> -Original Message- > From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general- > ow...@postgresql.org] On Behalf Of Alban Hertroys > Sent: Monday, July 16, 2012 1:44 PM > To: Daniele Varrazzo > Cc: Craig Ringer; Chris Bartlett; pgsql-general@postgresql.org > Subject: Re: [GENERAL] C

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Alban Hertroys
On 16 Jul 2012, at 17:57, Daniele Varrazzo wrote: > On Mon, Jul 16, 2012 at 3:56 PM, Craig Ringer wrote: >> On 07/16/2012 07:41 PM, Alban Hertroys wrote: > > BTW, that second value looks a whole lot like a poorly thought out > >> Yup. The 'infinity' value doesn't play well with all data

Re: [GENERAL] Create stored procedure from C#.net

2012-07-16 Thread Pavel Stehule
Hello 2012/7/16 postgresuser : > Hi, > I am using PostgreSql 8.3 version. I want to create stored procedure from > C#.net. Is it possible? Any idea. > What I know, it is not possible. somebody wrote wrapper for .NET, but this project was not finished ever Regards Pavel Stehule > -- > View this

[GENERAL] Create stored procedure from C#.net

2012-07-16 Thread postgresuser
Hi, I am using PostgreSql 8.3 version. I want to create stored procedure from C#.net. Is it possible? Any idea. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Create-stored-procedure-from-C-net-tp5716767.html Sent from the PostgreSQL - general mailing list archive at Nab

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Chris Angelico
On Tue, Jul 17, 2012 at 1:58 AM, Michael Nolan wrote: > As I understand the docs for rsync, it will use both mod time and file size > if told not to do checksums. Oh, so it does, I misread. Thanks! Time+size it is. ChrisA -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Michael Nolan
On 7/16/12, Chris Angelico wrote: > On Tue, Jul 17, 2012 at 1:40 AM, Michael Nolan wrote: >> I did several weeks of tests on 9.1.3 using mod time and file size >> rather than checksumming the files, that did not appear to cause any >> problems >> and it sped up the rsync considerably. (This was

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Daniele Varrazzo
On Mon, Jul 16, 2012 at 3:56 PM, Craig Ringer wrote: > On 07/16/2012 07:41 PM, Alban Hertroys wrote: BTW, that second value looks a whole lot like a poorly thought out > Yup. The 'infinity' value doesn't play well with all database access APIs > and languages, though. It doesn't even p

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Chris Angelico
On Tue, Jul 17, 2012 at 1:40 AM, Michael Nolan wrote: > I did several weeks of tests on 9.1.3 using mod time and file size > rather than checksumming the files, that did not appear to cause any problems > and it sped up the rsync considerably. (This was about a 40 GB database.) Thanks! Is file s

Re: [GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Michael Nolan
On 7/16/12, Chris Angelico wrote: > I'm speccing up a three-node database for reliability, making use of > streaming replication, and it's all working but I have a bit of a > performance concern. > > > Can the individual files' modification timestamps be relied upon? If > so, it'd potentially mean

Re: [GENERAL] DB fails to start: "Could not read from file "pg_clog/0003" at offset 212992: No error.

2012-07-16 Thread Craig Ringer
On 07/16/2012 09:55 PM, raghu ram wrote: On Mon, Jul 16, 2012 at 5:44 PM, Olga Vingurt > wrote: Hi, We are using PostgreSQL 8.3 on Windows Server. The db crashed and now it fails to start up. Crashed how? Did the *server* crash, or the database?

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Craig Ringer
On 07/16/2012 07:41 PM, Alban Hertroys wrote: BTW, that second value looks a whole lot like a poorly thought out substitute for 'infinity' ... regards, tom lane That's certainly an interesting comment and I'm open to suggestions! The original db has two columns (from_tim

Re: [GENERAL] DB fails to start: "Could not read from file "pg_clog/0003" at offset 212992: No error.

2012-07-16 Thread Raghavendra
I think you need to download windows version DD and use it. http://www.chrysocome.net/dd --- Regards, Raghavendra EnterpriseDB Corporation Blog: http://raghavt.blogspot.com/ On Mon, Jul 16, 2012 at 7:25 PM, raghu ram wrote: > > > On Mon, Jul 16, 2012 at 5:44 PM, Olga Vingurt wrote: > >> Hi,*

Re: [GENERAL] DB fails to start: "Could not read from file "pg_clog/0003" at offset 212992: No error.

2012-07-16 Thread raghu ram
On Mon, Jul 16, 2012 at 5:44 PM, Olga Vingurt wrote: > Hi, > > ** ** > > We are using PostgreSQL 8.3 on Windows Server. > > The db crashed and now it fails to start up. > > ** ** > > The error is: > > FATAL: could not access status of transaction 4020264 > > DETAIL: Could

[GENERAL] Replication terminated by primary server

2012-07-16 Thread Nicolau Roca
Hi, we have configured a synchronous master-slave replication. Node "postgres1" is the master, while node "postgres2" is the slave. It works fine, but when restarting the master (using "pg_ctl restart"), the replication is broken. In the slave log we have the following message: 2012-07-16 13:1

[GENERAL] DB fails to start: "Could not read from file "pg_clog/0003" at offset 212992: No error.

2012-07-16 Thread Olga Vingurt
Hi, We are using PostgreSQL 8.3 on Windows Server. The db crashed and now it fails to start up. The error is: FATAL: could not access status of transaction 4020264 DETAIL: Could not read from file "pg_clog/0003" at offset 212992: No error. Additional log from event viewer: LOG: database syste

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Alban Hertroys
>> BTW, that second value looks a whole lot like a poorly thought out >> substitute for 'infinity' ... >> regards, tom lane > > That's certainly an interesting comment and I'm open to suggestions! The > original db has two columns (from_timestamp, to_timestamp). I don't go f

Re: [GENERAL] Can't figure out how to use now() in default for tsrange column (PG 9.2)

2012-07-16 Thread Chris Bartlett
Chris Bartlett writes: I'm trying to set [now(), 2049-12-31 00:00:00) as the default for a tsrange column (Postgres 9.2), but can't figure out how to do it. I'm either getting syntax errors or now() is being evaluated, so that the default becomes something like [2012-07-14 14:04:35, 2049-12-

[GENERAL] Replication/cloning: rsync vs modification dates?

2012-07-16 Thread Chris Angelico
I'm speccing up a three-node database for reliability, making use of streaming replication, and it's all working but I have a bit of a performance concern. Suppose a node dies and is removed from the cluster, but then returns (say, a day or two later). I could, of course, utterly wipe the existing