[HACKERS] Incorrect handling of timezones with extract

2013-03-12 Thread Michael Paquier
Hi all, When running some QE tests at VMware, we found an error with extract handling timezones. Please see below: postgres=# show timezone; TimeZone Asia/Tokyo (1 row) postgres=# select now(); now --- 2013-03-12 14:54:28.911298+09 (1

[HACKERS] Fix document typo

2013-03-12 Thread Etsuro Fujita
I ran into a typo in the reference page on the SELECT command. Please find attached a patch. Best regards, Etsuro Fujita typo_fix_20130312.patch Description: Binary data -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription:

Re: [HACKERS] Incorrect handling of timezones with extract

2013-03-12 Thread Michael Paquier
On Tue, Mar 12, 2013 at 3:11 PM, Michael Paquier michael.paqu...@gmail.comwrote: postgres=# select extract(day from ((CAST(-3 || 'day' as interval)+now()) - now())); date_part --- -2 (1 row) Here I believe that the correct result should be -3. Note that it passes with

[HACKERS] Re: Proposal for Allow postgresql.conf values to be changed via SQL [review]

2013-03-12 Thread Greg Smith
On 3/11/13 12:19 PM, Greg Stark wrote: Think also about the case where someone wants to change multiple values together and having just some set and not others would be inconsistent. Isn't that an argument for syntax to make an exception though? If starting from a blank slate I would say

Re: Column defaults for foreign tables (was Re: [HACKERS] [v9.3] writable foreign tables)

2013-03-12 Thread Albe Laurenz
Tom Lane wrote: Thom Brown t...@linux.com writes: Out of curiosity, is there any way to explicitly force a foreign DEFAULT with column-omission? I've concluded that the ideal behavior probably is that if you have declared a DEFAULT expression for a foreign table's column, then that's what

Re: [HACKERS] Statistics and selectivity estimation for ranges

2013-03-12 Thread Heikki Linnakangas
On 01.03.2013 16:22, Alexander Korotkov wrote: These changes were made in attached patch. Thanks. I've been staring at this code for a very long time now, trying to understand how the math in calc_hist_selectivity_contained works. I think I understand it now, but it probably needs a lot

Re: [HACKERS] transforms

2013-03-12 Thread Andres Freund
On 2013-03-11 20:28:05 -0400, Peter Eisentraut wrote: On Mon, 2013-03-11 at 18:11 +0100, Andres Freund wrote: If we don't find a better solution, yes. Why don't we lookup type input/ouput function for parameters and return type during CREATE FUNCTION? That should solve the issue in a neater

Re: [HACKERS] Using indexes for partial index builds

2013-03-12 Thread Ants Aasma
On Mon, Mar 11, 2013 at 9:13 PM, Greg Stark st...@mit.edu wrote: On Thu, Mar 7, 2013 at 12:51 AM, Jim Nasby j...@nasby.net wrote: Something worth considering on this... I suspect it's possible to use an index-only scan to do this, regardless of whether the heap page is all visible. The reason

Re: [HACKERS] Fix document typo

2013-03-12 Thread Alvaro Herrera
Etsuro Fujita wrote: I ran into a typo in the reference page on the SELECT command. Please find attached a patch. Thanks for the note -- I fixed this in a different way. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training Services --

Re: [HACKERS] Proposal for Allow postgresql.conf values to be changed via SQL [review]

2013-03-12 Thread Greg Stark
On Tue, Mar 12, 2013 at 9:06 AM, Greg Smith g...@2ndquadrant.com wrote: That's jumping right over a few rounds of simpler ways to do this, and just going right to the approach we know allows adding more such options later with minimal grammar impact. As Craig intimated, the minimal grammar

Re: [HACKERS] Statistics and selectivity estimation for ranges

2013-03-12 Thread Heikki Linnakangas
On 01.03.2013 16:22, Alexander Korotkov wrote: I've been staring at this code for a very long time now, trying to understand how the math in calc_hist_selectivity_contained works. I think I understand it now, but it probably needs a lot more comments and perhaps some refactoring, so that the

Re: [HACKERS] Proposal for Allow postgresql.conf values to be changed via SQL [review]

2013-03-12 Thread Tom Lane
Greg Stark st...@mit.edu writes: As Craig intimated, the minimal grammar impact would be simply BEGIN; set persistent maintenance_work_mem='2GB'; set persistent work_mem='2GB'; COMMIT; Sending the sighup at transaction end seems like a fairly safe thing to do too. It's hard to imagine it

[HACKERS] Add some regression tests for SEQUENCE

2013-03-12 Thread robins
Hi, Attached is a small patch to test corner cases related to Sequences (basically aimed at increasing code-coverage of sequence.sql in regression tests). Look forward to any and all feedback. -- Robins Tharakan commit-sequence.patch Description: Binary data -- Sent via pgsql-hackers mailing

Re: [HACKERS] Incorrect handling of timezones with extract

2013-03-12 Thread Tom Lane
Michael Paquier michael.paqu...@gmail.com writes: On Tue, Mar 12, 2013 at 3:11 PM, Michael Paquier michael.paqu...@gmail.comwrote: postgres=# select extract(day from ((CAST(-3 || 'day' as interval)+now()) - now())); date_part --- -2 (1 row) Here I believe that the correct result

Re: [HACKERS] Incorrect handling of timezones with extract

2013-03-12 Thread Josh Berkus
and extract(day) from that gives -2 not -3. You could argue that this definition of timestamp subtraction isn't too consistent with the timestamp-plus-interval operator, and you'd be right; but I doubt we'd consider changing it now. We specifically added that feature to support production

Re: postgres_fdw vs data formatting GUCs (was Re: [HACKERS] [v9.3] writable foreign tables)

2013-03-12 Thread Daniel Farina
On Mon, Mar 11, 2013 at 7:04 PM, Tom Lane t...@sss.pgh.pa.us wrote: Daniel Farina dan...@heroku.com writes: I will try to make time for this, although it seems like the general approach should match pgsql_fdw if possible. Is the current thinking to forward the settings and then use the GUC

Re: postgres_fdw vs data formatting GUCs (was Re: [HACKERS] [v9.3] writable foreign tables)

2013-03-12 Thread Tom Lane
Daniel Farina dan...@heroku.com writes: Okay, I see. So inverting the thinking I wrote earlier: how about hearkening carefully to any ParameterStatus messages on the local side before entering the inner loop of dblink.c:materializeResult as to set the local GUC (and carefully dropping it back

Re: [HACKERS] Incorrect handling of timezones with extract

2013-03-12 Thread Tom Lane
Josh Berkus j...@agliodbs.com writes: and extract(day) from that gives -2 not -3. You could argue that this definition of timestamp subtraction isn't too consistent with the timestamp-plus-interval operator, and you'd be right; but I doubt we'd consider changing it now. We specifically

Re: Column defaults for foreign tables (was Re: [HACKERS] [v9.3] writable foreign tables)

2013-03-12 Thread Tom Lane
Albe Laurenz laurenz.a...@wien.gv.at writes: Do you think that it is possible to insert remote defaults by omitting columns like this: INSERT INTO foreigntable (col1, col3) VALUES (a, c); Well, that's how it works right now, but it's not good that it's inconsistent with the explicit-DEFAULT

Re: [HACKERS] Incorrect handling of timezones with extract

2013-03-12 Thread Josh Berkus
The behavior of timestamp-plus-interval is certainly supported by that argument, but I'm less convinced about timestamp-minus-timestamp. The raw result of the timestamp subtraction here is 71 hours (not the normal 72). Perhaps it should be outputting it that way instead of converting to 2

[HACKERS] Display output file name in psql prompt?

2013-03-12 Thread Alex
Hello fellow hackers, Today when I get back home and connected to my psql prompt I've left running under $terminal_multiplexor I've run some SQL, but no output did appear on my screen. I have immediately realized that it must be sending it to a file instead of STDOUT as I have instructed it

Re: [HACKERS] Display output file name in psql prompt?

2013-03-12 Thread Tom Lane
Alex a...@commandprompt.com writes: Today when I get back home and connected to my psql prompt I've left running under $terminal_multiplexor I've run some SQL, but no output did appear on my screen. I have immediately realized that it must be sending it to a file instead of STDOUT as I have

Re: [HACKERS] Display output file name in psql prompt?

2013-03-12 Thread Josh Berkus
Tom, If you're proposing changing the contents of the default prompt, I think that has very little chance of passing. A new option for something to add into a custom prompt might get accepted. I'm not sure that that approach would do much for the scenario you describe, since it's unlikely

[HACKERS] leaking lots of unreferenced inodes (pg_xlog files?), maybe after moving tables and indexes to tablespace on different volume

2013-03-12 Thread Palle Girgensohn
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi! Running postgresql-9.2.2 on FreeBSD 9.1 using vanilla ufs file system. I have the postgresql base/ on the /usr disk, and a separate volume /opt where the default tablespace resides. I found many databases that had not used the default

Re: [HACKERS] leaking lots of unreferenced inodes (pg_xlog files?), maybe after moving tables and indexes to tablespace on different volume

2013-03-12 Thread Tom Lane
Palle Girgensohn gir...@freebsd.org writes: ... I got lots of space freed up, but it seems that after that the disk usage grows linearly (it seems to leave many inodes unreferenced). Hm. We've seen issues in the past with PG processes failing to close no-longer-useful files promptly, but ...

Re: [HACKERS] Proposal for Allow postgresql.conf values to be changed via SQL [review]

2013-03-12 Thread Amit Kapila
On Tuesday, March 12, 2013 9:37 PM Tom Lane wrote: Greg Stark st...@mit.edu writes: As Craig intimated, the minimal grammar impact would be simply BEGIN; set persistent maintenance_work_mem='2GB'; set persistent work_mem='2GB'; COMMIT; Sending the sighup at transaction end seems