Re: [HACKERS] [COMMITTERS] pgsql: Oops, don't forget to rewind the directory before scanning it to

2010-02-22 Thread Andres Freund
On Monday 22 February 2010 04:58:29 Tom Lane wrote:
 Fujii Masao masao.fu...@gmail.com writes:
  +   Free(xldir);
  
  s/Free/FreeDir ?
 
 Yeah, that too.  I think it's all good now, but please test.
At least I havent seen any of the problems pointed out in fsync fun.

 One thing I was wondering was whether the stat-wrong-file problem
 could explain the buildfarm failures that we thought were evidence
 of a portability issue.  I was tempted to re-enable the #ifdef NOTYET
 code, but didn't want to pull that trigger while there were other
 problems outstanding.
I unfortunately dont think so. The mkdir above should not have been bothered 
by the stat issue - especially as it was only introduced by the commit to 
disable the fsyncing.

 I also think it should scan the todir not the fromdir, just on
 general principles to avoid any possibility of race conditions.
That one actually was my idea/code and intentional with the idea to error out 
at one more place if anything goes wrong in the copy loop - I could not think 
of any race issues created by that which were not there before.
On the other hand its unlikely to catch anything so I dont mind.

Andres

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Gokulakannan Somasundaram
Heikki,
 I had a quick look at the discussion on visibility map design. The
main differences as i see it are
a) IOT has both table and index in one structure. So no duplication of data
b) With visibility maps, we have three structures a) Table b) Index c)
Visibility map. So the disk footprint of the same data will be higher in
postgres ( 2x + size of the visibility map).
c) More than that, inserts and updates will incur two extra random i/os
every time. - one for updating the table and one for updating the visibility
map.

Are we going to ignore these differences?

Thanks,
Gokul.

On Mon, Feb 22, 2010 at 12:21 PM, Heikki Linnakangas 
heikki.linnakan...@enterprisedb.com wrote:

 Gokulakannan Somasundaram wrote:
  Hi,
  As you all know, Index Organized tables are a way by which we can
  automatically cluster the data based on the primary key. While i was
  thinking about an implementation for postgres, it looks like an
 impossible
  with the current ideologies. In an IOT, if a record gets updated, we need
 to
  mark the old row as deleted immediately, as we do with any other table.
 But
  since Postgres supports user defined data types and if they happen to be
 a
  broken data type, then we have an unstable IOT.(as there is no guarantee,
 we
  might hit the same record)
  This was the reason for which, the proposal on creating  indexes with
  snapshot was rejected.
  May i get a little clarification on this issue? Will we be supporting
  the IOT feature in postgres in future?

 What seems like the best path to achieve the kind of performance
 benefits that IOTs offer is allowing index-only-scans using the
 visibility map. I worked on that last summer, but unfortunately didn't
 have the time to finish anything.

 --
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com



Re: [HACKERS] scheduler in core

2010-02-22 Thread Simon Riggs
On Sun, 2010-02-21 at 20:46 +0100, Dimitri Fontaine wrote:
 Simon Riggs si...@2ndquadrant.com writes:
  There is currently no way to run a separate daemon process that runs
  user code as part of Postgres, so that the startup code gets run
  immediately we startup, re-run if we crash and shut down cleanly when
  the server does. If there were some way to run arbitrary code in a
  daemon using an extensibility API then we wouldn't ever get any requests
  for the scheduler, cos you could write it yourself without troubling
  anybody here.
 
 Please do include the Skytools / PGQ ticker as one use case in the
 design discussion, and pgbouncer too. Having user daemons as part as the
 PostgreSQL extensibility would be awesome indeed!
 
 Bonus point if you build them with PGXS and install them from SQL, so
 that the current extension packaging design applies.
 
 I guess we can say that the archive and restore command are precursors
 of managed user daemons, or say, integrated processes. So adding them
 to the use cases to cover would make sense.

Yes, I think so. Rough design...

integrated_user_processes = 'x, y, z'

would run x(), y() and z() in their own processes. These would execute
after startup, or at consistent point in recovery. The code for these
would come from preload_libraries etc.

They would not block smart shutdown, though their shudown sequence might
delay it. User code would be executed last at startup and first thing at
shutdown.

API would be user_process_startup(), user_process_shutdown().

-- 
 Simon Riggs   www.2ndQuadrant.com


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Greg Stark
On Mon, Feb 22, 2010 at 8:18 AM, Gokulakannan Somasundaram
gokul...@gmail.com wrote:
 a) IOT has both table and index in one structure. So no duplication of data
 b) With visibility maps, we have three structures a) Table b) Index c)
 Visibility map. So the disk footprint of the same data will be higher in
 postgres ( 2x + size of the visibility map).

These sound like the same point to me. I don't think we're concerned
with footprint -- only with how much of that footprint actually needs
to be scanned. So if we have a solution allowing the scan to only need
to look at the index then the extra footprint of the table doesn't
cost anything at run-time. And the visibility map is very small.


I think you would be better off looking for incremental improvements
rather than major architectural changes like having no heap for a
table. There are so many design decisions hinged on having a heap that
it would be impractical to rethink them all.

-- 
greg

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Gokulakannan Somasundaram
Forgot to include the group...

On Mon, Feb 22, 2010 at 4:31 PM, Gokulakannan Somasundaram 
gokul...@gmail.com wrote:



 These sound like the same point to me. I don't think we're concerned
 with footprint -- only with how much of that footprint actually needs
 to be scanned. So if we have a solution allowing the scan to only need
 to look at the index then the extra footprint of the table doesn't
 cost anything at run-time. And the visibility map is very small.


 Yep.. They are one and the same...
 Just wanted a clarification on the design goals going forward.

 Thanks,
 Gokul.




Re: [HACKERS] Streaming replication and pg_xlogfile_name()

2010-02-22 Thread Heikki Linnakangas
Fujii Masao wrote:
 On Thu, Jan 28, 2010 at 5:28 PM, Heikki Linnakangas
 heikki.linnakan...@enterprisedb.com wrote:
 How about extending the format of the string returned by
 pg_last_xlog_receive/replay_location() to include the timeline ID? When
 it currently returns e.g '6/200016C', it could return '1/6/200016C',
 where 1 is the timeline ID. Then just teach pg_xlogfile_name[_offset]()
 to accept that format as well.
 
 Sounds good. The attached patch does so. Also the code is available
 in the 'replication' branch in my git repository.

 --- 5866,5882 
   /* use volatile pointer to prevent code rearrangement */
   volatile XLogCtlData *xlogctl = XLogCtl;
   
 ! /*
 !  * initialize shared replayEndRecPtr, 
 recoveryLastRecPtr and
 !  * recoveryLastTLI. Actually, the latter two variables 
 don't need to
 !  * be initialized here since they are expected to be 
 updated at least
 !  * once until read only connections will have read 
 them. But just in
 !  * case.
 !  */
   SpinLockAcquire(xlogctl-info_lck);
   xlogctl-replayEndRecPtr = ReadRecPtr;
   xlogctl-recoveryLastRecPtr = ReadRecPtr;
 + xlogctl-recoveryLastTLI = curFileTLI;
   SpinLockRelease(xlogctl-info_lck);
   
   InRedo = true;

Thinking about this again, I'm not sure this is a good idea. Using
curFileTLI makes sense if you're going to call pg_xlogfile_name() and
would expect it to return the filename of the file containing the WAL
record being replayed. But in other contexts, it seems strange for
pg_last_replay_timeline() to return the TLI of the first record in the
file, rather than the actual record replayed.

I don't have any better ideas, though.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Time travel on the buildfarm

2010-02-22 Thread Andrew Dunstan



Tom Lane wrote:

It is currently 22:21:59 EST here.  At 21:50 I committed a fix to
copydir.c that cleaned up a couple of thinkos by Greg, including
a misspelling that had been making all the builds fail for several
hours.  I went to see if any of the buildfarm had gone green yet,
and indeed half a dozen members had --- but they are all claiming
to be using snapshots between 00:44:53 and 00:51:20 old.  Unless
the cvs mirror can see into the future, that's a lie.  I'm not
sure how the ages on the buildfarm show_status.pl page are generated,
but I'm betting somebody's local clock is off.


  


Thanks for the report.

The buildfarm server is currently reporting a time 25 minutes too fast. 
I have previously discussed with the server administrators the necessity 
of running an NTP daemon on the machine, but I will do so again.


This is one area where git (or almost anything but CVS) would server us 
better. With git or even Subversion, we would report the tree version as 
well as the timestamp.


cheers

andrew

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Alvaro Herrera
Greg Stark escribió:
 On Mon, Feb 22, 2010 at 8:18 AM, Gokulakannan Somasundaram
 gokul...@gmail.com wrote:
  a) IOT has both table and index in one structure. So no duplication of data
  b) With visibility maps, we have three structures a) Table b) Index c)
  Visibility map. So the disk footprint of the same data will be higher in
  postgres ( 2x + size of the visibility map).
 
 These sound like the same point to me. I don't think we're concerned
 with footprint -- only with how much of that footprint actually needs
 to be scanned. So if we have a solution allowing the scan to only need
 to look at the index then the extra footprint of the table doesn't
 cost anything at run-time. And the visibility map is very small.

Moreover, the visibility map is already there.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Plans for 9.1, Grouping Sets, disabling multiqueries, contrib module for string, plpgpsm, preload dictionaries

2010-02-22 Thread Alvaro Herrera
Pavel Stehule escribió:
 Hello,
 
 * Now I am working on migration of plpgpsm to plpgsql 9.0 base. I hope
 so I understand SQL/PSM well so I am able to write production quality
 implementation. If you like, I can integrate it to core. It can share
 about 40-50% code with plpgpsm. The behave of plpgpsm is same as
 plpgsql - without some plpgsql's historical issues (about FOUND, about
 NULL and record type). SQL/PSM is litlle bit richer language. Now we
 have not any wide used runtime so I don't thinking about rewriting.
 Maybe we can rewrite these PL language for parrot or lua runtime in
 future. But this step isn't necessary - people hasn't performance
 problems with PL based on PL runtime.

How do you plan to go about code sharing?  I'm wondering if we're going
to have src/pl/common or something like that.  Since there's a huge
amount of common code it doesn't make any sense to keep it duplicate.

Also, AFAIR that was the main rejection point for the plpgpsm patch last
time around, so it would be good to discuss this thoroughly.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] ALTER TABLE documentation

2010-02-22 Thread Robert Haas
I just noticed that the current ALTER TABLE documentation doesn't do a
very good job differentiating between commands that affect the whole
table and commands that only affect specific columns.

http://developer.postgresql.org/pgdocs/postgres/sql-altertable.html

That didn't matter as much before, but now that we have both
table-level options and attribute-level options, there are two
sections in there that look all-too-similar...  suggestions?

...Robert

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after

2010-02-22 Thread Tom Lane
Greg Stark gsst...@mit.edu writes:
 On Mon, Feb 22, 2010 at 2:54 AM, Tom Lane t...@sss.pgh.pa.us wrote:
 I also think it should scan the todir not the fromdir, just on
 general principles to avoid any possibility of race conditions.

 I had concluded that scanning the original directory was odd but
 better because it served to double-check that all the original files
 actually made it and also because if there were any unrelated files
 present there was no need to fsync them.

Well, just for the record: if that was actually intentional then both of
you erred seriously by not including a comment that explained that the
coding was intentional (and giving the reasoning).  Any reader of the
code would have assumed that it was a copy-and-paste error, as I did.

 But I agree it's odd and not
 very general for copydir if we decide to use it elsewhere other than
 create database.

Yeah, to me it seems more likely to cause problems down the road than
to catch anything.  If the system is missing directory entries during
ReadDir then we have problems far beyond what copydir can deal with.
The point of the fsync loop is just to force the copy results down to
the platter, not to cross-check that the source directory isn't
changing.  (And, what's more, I don't believe that the source directory
can't change during CREATE DATABASE.  Consider delayed cleanup of
deleted relations during checkpoints.)

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Plans for 9.1, Grouping Sets, disabling multiqueries, contrib module for string, plpgpsm, preload dictionaries

2010-02-22 Thread Pavel Stehule
2010/2/22 Alvaro Herrera alvhe...@commandprompt.com:
 Pavel Stehule escribió:
 Hello,

 * Now I am working on migration of plpgpsm to plpgsql 9.0 base. I hope
 so I understand SQL/PSM well so I am able to write production quality
 implementation. If you like, I can integrate it to core. It can share
 about 40-50% code with plpgpsm. The behave of plpgpsm is same as
 plpgsql - without some plpgsql's historical issues (about FOUND, about
 NULL and record type). SQL/PSM is litlle bit richer language. Now we
 have not any wide used runtime so I don't thinking about rewriting.
 Maybe we can rewrite these PL language for parrot or lua runtime in
 future. But this step isn't necessary - people hasn't performance
 problems with PL based on PL runtime.

 How do you plan to go about code sharing?  I'm wondering if we're going
 to have src/pl/common or something like that.  Since there's a huge
 amount of common code it doesn't make any sense to keep it duplicate.

sure - a there a a few parts - simple query diagnostic, namespace
support. Now I would to migrate to 9.0 and have initial version. This
version and regress tests can be used as etalon. Next stage can be
code cleaning and migration to shared code.

Pavel











 Also, AFAIR that was the main rejection point for the plpgpsm patch last
 time around, so it would be good to discuss this thoroughly.

 --
 Alvaro Herrera                                http://www.CommandPrompt.com/
 The PostgreSQL Company - Command Prompt, Inc.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] ALTER TABLE SET STATISTICS requires AccessExclusiveLock

2010-02-22 Thread Bruce Momjian
Simon Riggs wrote:
 On Mon, 2009-10-19 at 12:56 -0300, Alvaro Herrera wrote:
  Simon Riggs wrote:
   
   On Fri, 2009-08-07 at 15:58 -0400, Alvaro Herrera wrote:
Tom Lane wrote:
 Peter Eisentraut pete...@gmx.net writes:
  Is there a good reason for $subject, other than that the code is 
  entangled 
  with other ALTER TABLE code?
 
 I think it could be lower, but it would take nontrivial restructuring 
 of
 the ALTER TABLE support.  In particular, consider what happens when 
 you
 have a list of subcommands that don't all require the same lock level.
 I think you'd need to scan the list and find the highest required lock
 level before starting ...

IIRC there was a patch from Simon to address this issue, but it had some
holes which he didn't have time to close, so it sank.  Maybe this can be
resurrected and fixed.
   
   I was intending to finish that patch in this release cycle.
  
  Since you're busy with Hot Standby, any chance you could pass it on?
 
 If you'd like. It's mostly finished, just one last thing to finish:
 atomic changes to pg_class via an already agreed API.

I assume this did not get done for 9.0.  Do we want a TODO item?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after

2010-02-22 Thread Tom Lane
BTW, I notice that after allegedly fixing things, we are now seeing
fsync failures during CREATE DATABASE in the installcheck phase of
buildfarm runs on (apparently) all the Windows critters, plus a
couple of other platforms too.  This mystifies me.  I could believe
that there was something still wrong with copydir.c, but then how
come these machines are getting through the earlier make check
phase?

I made a couple of code tweaks just now to try to get more information
--- the reported EBADF error numbers seem fairly implausible in
themselves, so I wondered if that's *really* what fsync is reporting.
I don't have a lot of hope for that though.

Any theories about what is happening?

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Magnus Hagander
2010/2/20 Tom Lane t...@sss.pgh.pa.us:
 Bruce Momjian br...@momjian.us writes:
 Tom Lane wrote:
 Chris Campbell chris_campb...@mac.com writes:
 Is there a way to detect when the SSL library has renegotiation disabled?

 Probably not.  The current set of emergency security patches would
 certainly not have exposed any new API that would help us tell this :-(

 If said patches were done properly they'd have also turned an
 application-level renegotiation request into a no-op, instead of
 breaking apps by making it fail --- but apparently they were not done
 properly.

 Is there anything remaining to do on this issue?

 I'm not sure.  My impression is that by the time we had anything in the
 field, there will be real fixes for the SSL renegotiation problem.
 So all we'd be accomplishing is to weaken security for people who have
 those fixes, to cater to people who are using copies of openssl they'd
 obtained in the past couple of months and then not updated to latest.
 However, if anyone thinks that the SSL problem isn't going to get fixed
 promptly, maybe it needs more consideration.

The problem with this is, I think, that there are semi-patched
versions of OpenSSL out there, that simply *break*. Instead of not
doing renegotiation when we ask for it, they break it and return an
error, thus canceling the connection. Correct?

If so, shouldn't we try to disable renegotiation for all versions
*before* it was properly fixed?

Which today means all versions released. The proper fix is in 0.9.8m,
which is currently in beta. At least that's my understanding.


The way I read it, the code now does:
* If the user has an old version of openssl, exposes the user to the
security issue and makes the connection insecure
* OpenSSL 0.9.8l, breaks the connection whenever renegotiation
happens, but doesn't compromise security
* OpenSSL 0.9.8m-beta, does the right thing.

Do we have any idea of what people like RHEL are doing wrt
backpatching these things?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes:
 If so, shouldn't we try to disable renegotiation for all versions
 *before* it was properly fixed?

If we could tell that, sure.  But I don't believe there is any way to
identify whether a given installation of openssl has this patched.
Please don't suggest looking at the version number --- Red Hat and
other vendors are in the habit of back-patching security fixes without
changing the version number.

 Which today means all versions released. The proper fix is in 0.9.8m,
 which is currently in beta. At least that's my understanding.

Red Hat's already shipping the patch.  Dunno about other vendors.

The real bottom line here is that this isn't our bug.  It's unfortunate
that we're affected by it, but that doesn't mean that we should be
installing kluges to work around it.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Magnus Hagander
2010/2/22 Tom Lane t...@sss.pgh.pa.us:
 Magnus Hagander mag...@hagander.net writes:
 If so, shouldn't we try to disable renegotiation for all versions
 *before* it was properly fixed?

 If we could tell that, sure.  But I don't believe there is any way to
 identify whether a given installation of openssl has this patched.
 Please don't suggest looking at the version number --- Red Hat and
 other vendors are in the habit of back-patching security fixes without
 changing the version number.

That, if anything, is a bug :( But yes, it's a bug lots of linux
distros seem to consider a feature :(


 Which today means all versions released. The proper fix is in 0.9.8m,
 which is currently in beta. At least that's my understanding.

 Red Hat's already shipping the patch.  Dunno about other vendors.

Which patch? The one that breaks it, or the one that changes the protocol?


 The real bottom line here is that this isn't our bug.  It's unfortunate
 that we're affected by it, but that doesn't mean that we should be
 installing kluges to work around it.

True. But people will call it our problem.

One way to deal with it would be to expose the whole renegotiation
setting as a user configuratble option. So they can set *when* we
renegotiate, which would also let them turn it off completely. There
are probably people who would like to change it, but there certainly
haven't been enough of them so we've heard lots of complains. And it's
definitely not back-patchable.


We also have to consider our Windows users, where *we* ship the
OpenSSL library. Where there is no library we can ship right now that
fixes it.

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes:
 2010/2/22 Tom Lane t...@sss.pgh.pa.us:
 Red Hat's already shipping the patch.  Dunno about other vendors.

 Which patch? The one that breaks it, or the one that changes the protocol?

The one with the protocol change.

I think we already missed the window where it would have been sensible
to install a hack workaround for this.  If we'd done that in November
it might have been reasonable, but by now it's too late for any hack
we install to spread much faster than fixed openssl libraries.

 One way to deal with it would be to expose the whole renegotiation
 setting as a user configuratble option. So they can set *when* we
 renegotiate, which would also let them turn it off completely.

Well, that might be a reasonable thing to do, because it's not just a
temporary kluge (that we won't know when to remove) but is adding an
arguably-useful-in-other-ways knob.

 And it's definitely not back-patchable.

Why not?  We certainly wouldn't back-patch such a thing if we didn't
have a problem to deal with, but it's not like there's no precedent
for adding back-patched GUCs in response to security issues.  We
did that with backslash_quote.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] Reason why set-value functions not allowed in GREATEST(), etc?

2010-02-22 Thread Hitoshi Harada
I just wonder why generate_series() is not allowed in GREATEST syntax.
Looking through execQual.c,  almost all syntactic evaluations like
COALESCE, ARRAY[], ROW() doesn't allow set-value functions. Could
someone tell the underlying reason?

Also, using variadic functions introduced since 8.4, I hope we can
remove the special syntax cases for them by replacing them with normal
variadic functions. Is it sane idea?

Regards,

-- 
Hitoshi Harada

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Joshua D. Drake
On Mon, 22 Feb 2010 12:25:08 -0500, Tom Lane t...@sss.pgh.pa.us wrote:
 Magnus Hagander mag...@hagander.net writes:
 2010/2/22 Tom Lane t...@sss.pgh.pa.us:
 Red Hat's already shipping the patch.  Dunno about other vendors.
 
 Which patch? The one that breaks it, or the one that changes the
 protocol?
 
 The one with the protocol change.
 
 I think we already missed the window where it would have been sensible
 to install a hack workaround for this.  If we'd done that in November
 it might have been reasonable, but by now it's too late for any hack
 we install to spread much faster than fixed openssl libraries.

Perhaps I am missing something here but as it is not our bug but is a
known bug, why can't we just say:

ERROR: SSL FATAL: Renogiation failed. Check OpenSSL bug list 

Yes the wording is miserable, change it but the point I think is clear.

I think it is completely reasonable to have warnings or errors that point
to other areas. If nothing else when it comes to our list we can say, What
is the error message you get and then we say, 
Did you check the OpenSSL bug list?.

I have to do similar things with PITRTools because of various unknown but
possibly successful states (like files changing underneath rsync).

Joshua D. Drake



-- 
PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] scheduler in core

2010-02-22 Thread Jaime Casanova
On Sun, Feb 21, 2010 at 1:11 PM, Simon Riggs si...@2ndquadrant.com wrote:
[...]
 Dimitri Fontaine dfonta...@hi-media.com writes:
  Dave Page dp...@pgadmin.org writes:
  Why not just use pgAgent? It's far more flexible than the design
  you've suggested, and already exists.

  What would it take to have it included in core,

[...]

 There is currently no way to run a separate daemon process that runs
 user code as part of Postgres, so that the startup code gets run
 immediately we startup, re-run if we crash and shut down cleanly when
 the server does. If there were some way to run arbitrary code in a
 daemon using an extensibility API then we wouldn't ever get any requests
 for the scheduler, cos you could write it yourself without troubling
 anybody here.


ah! that could get rid of one of my complaints, and then i could just
work the rest in pgAgent...
so, is this idea (having some user processes be tied to postmaster
start/stop) going to somewhere?

it also could help if we you have processes LISTENing for NOTIFYs

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Joshua D. Drake
On Mon, 22 Feb 2010 18:00:33 +0100, Magnus Hagander mag...@hagander.net
wrote:

 We also have to consider our Windows users, where *we* ship the
 OpenSSL library. Where there is no library we can ship right now that
 fixes it.

We do? I mean I know that we provide the old 8.2/8.3 pginstaller, but EDB 
is the provider of w32 binaries, not the community.

Joshua D. Drake

-- 
PostgreSQL - XMPP: jdrake(at)jabber(dot)postgresql(dot)org
   Consulting, Development, Support, Training
   503-667-4564 - http://www.commandprompt.com/
   The PostgreSQL Company, serving since 1997

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Magnus Hagander
2010/2/22 Joshua D. Drake j...@commandprompt.com:
 On Mon, 22 Feb 2010 18:00:33 +0100, Magnus Hagander mag...@hagander.net
 wrote:

 We also have to consider our Windows users, where *we* ship the
 OpenSSL library. Where there is no library we can ship right now that
 fixes it.

 We do? I mean I know that we provide the old 8.2/8.3 pginstaller, but EDB
 is the provider of w32 binaries, not the community.

How does that change the fact even a tiny bit for the end user?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Chris Campbell
On Feb 22, 2010, at 12:25 PM, Tom Lane wrote:

 I think we already missed the window where it would have been sensible
 to install a hack workaround for this.  If we'd done that in November
 it might have been reasonable, but by now it's too late for any hack
 we install to spread much faster than fixed openssl libraries.

Could we simply ignore renegotiation errors? Or change them to warnings? That 
may enable us to work with the semi-fixed OpenSSL libraries that are currently 
in the field, without disabling the functionality altogether. 

- Chris


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Bruce Momjian
Simon Riggs wrote:
 On Thu, 2009-10-15 at 00:26 +0300, Peter Eisentraut wrote:
  On Wed, 2009-10-14 at 15:06 -0300, Alvaro Herrera wrote:
   Simon Riggs wrote:

When I run ./configure, I get

(...warning..)
(If you are using the official distribution of PostgreSQL then you do
not need to worry about this because the Flex output is pre-generated.)

Well, I am am using the official distribution of PostreSQL and the
output is not pre-generated. Clearly this message only comes when you
build Postgres from source, in which case the output cannot be
pre-generated (can it?). 
   
   I take it official distribution means tarball as different from a
   copy obtained thru CVS.
  
  Maybe If you are using an official release tarball of PostgreSQL, or
  an official release source code archive of PostgreSQL if we want to
  avoid the term tarball.
 
 Something like...
 
 If you have downloaded a full copy of the source then
 If you are building from a repository checkout ...
 
 We don't need to use the word tarball, but we do need to say what we
 mean. Anyway, its a seldom-used error message and I wouldn't have hit it
 if my laptop hadn't needed recovery.

With the attached patch, I have updated the message to use the wording
bundled distribution.  I think the point about the snapshot tarballs
and official releases is that they are bundled rather than pulled via
CVS.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +
Index: configure
===
RCS file: /cvsroot/pgsql/configure,v
retrieving revision 1.673
diff -c -c -r1.673 configure
*** configure	19 Feb 2010 18:42:29 -	1.673
--- configure	22 Feb 2010 17:56:52 -
***
*** 6736,6748 
{ $as_echo $as_me:$LINENO: WARNING:
  *** Without Bison you will not be able to build PostgreSQL from CVS nor
  *** change any of the parser definition files.  You can obtain Bison from
! *** a GNU mirror site.  (If you are using the official distribution of
  *** PostgreSQL then you do not need to worry about this, because the Bison
  *** output is pre-generated.) 5
  $as_echo $as_me: WARNING:
  *** Without Bison you will not be able to build PostgreSQL from CVS nor
  *** change any of the parser definition files.  You can obtain Bison from
! *** a GNU mirror site.  (If you are using the official distribution of
  *** PostgreSQL then you do not need to worry about this, because the Bison
  *** output is pre-generated.) 2;}
  fi
--- 6736,6748 
{ $as_echo $as_me:$LINENO: WARNING:
  *** Without Bison you will not be able to build PostgreSQL from CVS nor
  *** change any of the parser definition files.  You can obtain Bison from
! *** a GNU mirror site.  (If you are using the bundled distribution of
  *** PostgreSQL then you do not need to worry about this, because the Bison
  *** output is pre-generated.) 5
  $as_echo $as_me: WARNING:
  *** Without Bison you will not be able to build PostgreSQL from CVS nor
  *** change any of the parser definition files.  You can obtain Bison from
! *** a GNU mirror site.  (If you are using the bundled distribution of
  *** PostgreSQL then you do not need to worry about this, because the Bison
  *** output is pre-generated.) 2;}
  fi
***
*** 6800,6812 
{ $as_echo $as_me:$LINENO: WARNING:
  *** Without Flex you will not be able to build PostgreSQL from CVS nor
  *** change any of the scanner definition files.  You can obtain Flex from
! *** a GNU mirror site.  (If you are using the official distribution of
  *** PostgreSQL then you do not need to worry about this because the Flex
  *** output is pre-generated.) 5
  $as_echo $as_me: WARNING:
  *** Without Flex you will not be able to build PostgreSQL from CVS nor
  *** change any of the scanner definition files.  You can obtain Flex from
! *** a GNU mirror site.  (If you are using the official distribution of
  *** PostgreSQL then you do not need to worry about this because the Flex
  *** output is pre-generated.) 2;}
  
--- 6800,6812 
{ $as_echo $as_me:$LINENO: WARNING:
  *** Without Flex you will not be able to build PostgreSQL from CVS nor
  *** change any of the scanner definition files.  You can obtain Flex from
! *** a GNU mirror site.  (If you are using the bundled distribution of
  *** PostgreSQL then you do not need to worry about this because the Flex
  *** output is pre-generated.) 5
  $as_echo $as_me: WARNING:
  *** Without Flex you will not be able to build PostgreSQL from CVS nor
  *** change any of the scanner definition files.  You can obtain Flex from
! *** a GNU mirror site.  (If you are using the bundled distribution of
  *** PostgreSQL then you do not need to worry about this because the Flex
  *** output is 

Re: [HACKERS] transaction_isolation vs. default_transaction_isolation

2010-02-22 Thread Bruce Momjian
Josh Berkus wrote:
 
  Yeah, they basically have semantics specified by the SQL standard that
  are not compatible with anything else in GUC land.  They are more like
  SET LOCAL settings, but again not quite.
 
 Mind you, transaction_isolation and transaction_read_only aren't
 documented anywhere in our docs *as settings*, even though they show up
 in pg_settings.
 
 Doc patch coming ...

What are we doing with this?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Wire protocol docs

2010-02-22 Thread Bruce Momjian
Dave Page wrote:
 On Tue, Oct 13, 2009 at 6:24 PM, Tom Lane t...@sss.pgh.pa.us wrote:
  Dave Page dp...@pgadmin.org writes:
  Right. My complaint though, is that the docs imply that the info on
  how those values get set is in the docs somewhere, which appears to be
  incorrect.
 
  The libpq documentation does cover the fact that libpq uses those
  variables to establish initial settings. ?I wouldn't expect it to
  go into implementation details, would you?
 
 Not the libpq docs, no. I was expecting something to though, having
 been told in the intro to the low level protocol details that:
 
 Higher level features built on this protocol (for example, how libpq
 passes certain environment variables when the connection is
 established) are covered elsewhere.
 
 Note that it says *how* libpq passes those variables which implies the
 mechanism of passing them to the server. Anyway, I can figure out what
 I need from the existing code - I just found that sentence misleading
 and think it should probably be removed.

Agreed, removed.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Alvaro Herrera
Bruce Momjian wrote:
 Simon Riggs wrote:

  If you have downloaded a full copy of the source then
  If you are building from a repository checkout ...
  
  We don't need to use the word tarball, but we do need to say what we
  mean. Anyway, its a seldom-used error message and I wouldn't have hit it
  if my laptop hadn't needed recovery.
 
 With the attached patch, I have updated the message to use the wording
 bundled distribution.  I think the point about the snapshot tarballs
 and official releases is that they are bundled rather than pulled via
 CVS.

That's too subtle.  I wouldn't figure out what it means if my life
depended on it (then again, it doesn't).

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Bruce Momjian
Alvaro Herrera wrote:
 Bruce Momjian wrote:
  Simon Riggs wrote:
 
   If you have downloaded a full copy of the source then
   If you are building from a repository checkout ...
   
   We don't need to use the word tarball, but we do need to say what we
   mean. Anyway, its a seldom-used error message and I wouldn't have hit it
   if my laptop hadn't needed recovery.
  
  With the attached patch, I have updated the message to use the wording
  bundled distribution.  I think the point about the snapshot tarballs
  and official releases is that they are bundled rather than pulled via
  CVS.
 
 That's too subtle.  I wouldn't figure out what it means if my life
 depended on it (then again, it doesn't).

Well, official made no sense.  Bundled seemed similar enough to
tarball.  What suggestion do you have?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Reason why set-value functions not allowed in GREATEST(), etc?

2010-02-22 Thread Pavel Stehule
2010/2/22 Hitoshi Harada umi.tan...@gmail.com:
 I just wonder why generate_series() is not allowed in GREATEST syntax.
 Looking through execQual.c,  almost all syntactic evaluations like
 COALESCE, ARRAY[], ROW() doesn't allow set-value functions. Could
 someone tell the underlying reason?

 Also, using variadic functions introduced since 8.4, I hope we can
 remove the special syntax cases for them by replacing them with normal
 variadic functions. Is it sane idea?

we cannot do it :(

we cannot ensure similar coercion for these functions with variadic
functions. Variadic functions use a generic coercion.

Regards
Pavel Stehule


 Regards,

 --
 Hitoshi Harada

 --
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] scheduler in core

2010-02-22 Thread Heikki Linnakangas
Jaime Casanova wrote:
 On Sun, Feb 21, 2010 at 1:11 PM, Simon Riggs si...@2ndquadrant.com wrote:
 There is currently no way to run a separate daemon process that runs
 user code as part of Postgres, so that the startup code gets run
 immediately we startup, re-run if we crash and shut down cleanly when
 the server does. If there were some way to run arbitrary code in a
 daemon using an extensibility API then we wouldn't ever get any requests
 for the scheduler, cos you could write it yourself without troubling
 anybody here.
 
 ah! that could get rid of one of my complaints, and then i could just
 work the rest in pgAgent...

Yeah, seems like a good idea. Slon daemon and similar daemons could also
use it.

 so, is this idea (having some user processes be tied to postmaster
 start/stop) going to somewhere?

I've added this to the TODO list. Now we just need someone to write it.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] scheduler in core

2010-02-22 Thread Pavel Stehule
2010/2/22 Heikki Linnakangas heikki.linnakan...@enterprisedb.com:
 Jaime Casanova wrote:
 On Sun, Feb 21, 2010 at 1:11 PM, Simon Riggs si...@2ndquadrant.com wrote:
 There is currently no way to run a separate daemon process that runs
 user code as part of Postgres, so that the startup code gets run
 immediately we startup, re-run if we crash and shut down cleanly when
 the server does. If there were some way to run arbitrary code in a
 daemon using an extensibility API then we wouldn't ever get any requests
 for the scheduler, cos you could write it yourself without troubling
 anybody here.

 ah! that could get rid of one of my complaints, and then i could just
 work the rest in pgAgent...

 Yeah, seems like a good idea. Slon daemon and similar daemons could also
 use it.


I like it. I thought about some workflow system integrated with scheduler.

Regards
Pavel


 so, is this idea (having some user processes be tied to postmaster
 start/stop) going to somewhere?

 I've added this to the TODO list. Now we just need someone to write it.

 --
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

 --
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Jaime Casanova
On Mon, Feb 22, 2010 at 1:18 PM, Heikki Linnakangas
heikki.linnakan...@enterprisedb.com wrote:
 Jaime Casanova wrote:

 so, is this idea (having some user processes be tied to postmaster
 start/stop) going to somewhere?

 I've added this to the TODO list. Now we just need someone to write it.


if we can do this, how should it work?
Simon said:

Yes, I think so. Rough design...

integrated_user_processes = 'x, y, z'

would run x(), y() and z() in their own processes. These would execute
after startup, or at consistent point in recovery. The code for these
would come from preload_libraries etc.

They would not block smart shutdown, though their shudown sequence might
delay it. User code would be executed last at startup and first thing at
shutdown.

API would be user_process_startup(), user_process_shutdown().


so it should be a GUC, that is settable only at start time.
we need those integrated processes at all when in a standby server?

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] scheduler in core

2010-02-22 Thread Merlin Moncure
On Sat, Feb 20, 2010 at 8:06 PM, Joshua D. Drake j...@commandprompt.com wrote:

 That doesn't mean it isn't a really good idea. It would be nice to have
 a comprehensive job scheduling solution that allows me to continue
 abstract away from external solutions and operating system dependencies.

+1!

Aa scheduler is an extremely common thing to have to integrate with
the database.  All of our commercial competitors have them, and they
are heavily used.

Like I noted above, what people want to schedule is going to be stored
procedures.  Having both would virtually eliminate the need for
scripting outside the database, which is a pretty big deal since
external scripts are a real pain to keep cross platform.  Since
there's probably a lot of overlapping problems in those two features,
why not tackle both at once?

merlin

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Joshua D. Drake
On Mon, 2010-02-22 at 18:45 +0100, Magnus Hagander wrote:
 2010/2/22 Joshua D. Drake j...@commandprompt.com:
  On Mon, 22 Feb 2010 18:00:33 +0100, Magnus Hagander mag...@hagander.net
  wrote:
 
  We also have to consider our Windows users, where *we* ship the
  OpenSSL library. Where there is no library we can ship right now that
  fixes it.
 
  We do? I mean I know that we provide the old 8.2/8.3 pginstaller, but EDB
  is the provider of w32 binaries, not the community.
 
 How does that change the fact even a tiny bit for the end user?

Only that EDB may chose to put in there own solution.

Joshua D. Drake


-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 503.667.4564
Consulting, Training, Support, Custom Development, Engineering
Respect is earned, not gained through arbitrary and repetitive use or Mr. or 
Sir.


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Heikki Linnakangas
Jaime Casanova wrote:
  if we can do this, how should it work?
 Simon said:
 
 Yes, I think so. Rough design...
 
 integrated_user_processes = 'x, y, z'
 
 would run x(), y() and z() in their own processes. These would execute
 after startup, or at consistent point in recovery. The code for these
 would come from preload_libraries etc.
 
 They would not block smart shutdown, though their shudown sequence might
 delay it. User code would be executed last at startup and first thing at
 shutdown.
 
 API would be user_process_startup(), user_process_shutdown().
 
 
 so it should be a GUC, that is settable only at start time.

A GUC like that was my first thought too. We've already come up with
many uses for it, so whatever the interface is, will need to make sure
it's flexible enough to cater for all the use cases.

 we need those integrated processes at all when in a standby server?

Yes. You might want to run e.g. scheduled reports from a standby
reporting server, launched by a scheduler process. Or backups.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Jaime Casanova
On Mon, Feb 22, 2010 at 1:50 PM, Heikki Linnakangas
heikki.linnakan...@enterprisedb.com wrote:

 we need those integrated processes at all when in a standby server?

 Yes. You might want to run e.g. scheduled reports from a standby
 reporting server, launched by a scheduler process. Or backups.


ah! fair enough!

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Alvaro Herrera
Bruce Momjian wrote:
 Alvaro Herrera wrote:

  That's too subtle.  I wouldn't figure out what it means if my life
  depended on it (then again, it doesn't).
 
 Well, official made no sense.  Bundled seemed similar enough to
 tarball.  What suggestion do you have?

tarball ?

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Dave Page
On 2/22/10, Joshua D. Drake j...@commandprompt.com wrote:
 On Mon, 2010-02-22 at 18:45 +0100, Magnus Hagander wrote:
 2010/2/22 Joshua D. Drake j...@commandprompt.com:
  On Mon, 22 Feb 2010 18:00:33 +0100, Magnus Hagander
  mag...@hagander.net
  wrote:
 
  We also have to consider our Windows users, where *we* ship the
  OpenSSL library. Where there is no library we can ship right now that
  fixes it.
 
  We do? I mean I know that we provide the old 8.2/8.3 pginstaller, but
  EDB
  is the provider of w32 binaries, not the community.

 How does that change the fact even a tiny bit for the end user?

 Only that EDB may chose to put in there own

We're certainly not going to be shipping anything but standard
PostgreSQL, and i don't have the cycles or energy to try building
bespoke versions of openssl.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Magnus Hagander
2010/2/22 Chris Campbell chris_campb...@mac.com:
 On Feb 22, 2010, at 12:25 PM, Tom Lane wrote:

 I think we already missed the window where it would have been sensible
 to install a hack workaround for this.  If we'd done that in November
 it might have been reasonable, but by now it's too late for any hack
 we install to spread much faster than fixed openssl libraries.

 Could we simply ignore renegotiation errors? Or change them to warnings? That 
 may enable us to work with the semi-fixed OpenSSL libraries that are 
 currently in the field, without disabling the functionality altogether.

I guess we could, but if we do that then we've opened a window where
someone can attack us if we *have* a properly working openssl, haven't
we?


-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Magnus Hagander
2010/2/22 Tom Lane t...@sss.pgh.pa.us:
 Magnus Hagander mag...@hagander.net writes:
 2010/2/22 Tom Lane t...@sss.pgh.pa.us:
 Red Hat's already shipping the patch.  Dunno about other vendors.

 Which patch? The one that breaks it, or the one that changes the protocol?

 The one with the protocol change.

Ok. If RedHat has done it, I think we're in reasonably good shape.
From what I can tell, Debian doesn't have the broken *or* non-broken
patch in, but I'm not certain.


 I think we already missed the window where it would have been sensible
 to install a hack workaround for this.  If we'd done that in November
 it might have been reasonable, but by now it's too late for any hack
 we install to spread much faster than fixed openssl libraries.

Yeah, seems so.


 One way to deal with it would be to expose the whole renegotiation
 setting as a user configuratble option. So they can set *when* we
 renegotiate, which would also let them turn it off completely.

 Well, that might be a reasonable thing to do, because it's not just a
 temporary kluge (that we won't know when to remove) but is adding an
 arguably-useful-in-other-ways knob.

Yeah, the question is, how useful is it?

 And it's definitely not back-patchable.

 Why not?  We certainly wouldn't back-patch such a thing if we didn't
 have a problem to deal with, but it's not like there's no precedent
 for adding back-patched GUCs in response to security issues.  We
 did that with backslash_quote.

Hmm, I guess. It's a new feature, but if it's necessary..

That would take care of things on Windows as well. We could then just
disable renegotiation when we ship the known broken binaries.

You'd still have to turn it off on the server side if you have a
*single* client that has the broken patch, but that's still a lot
better than nothing.

Think it's worth taking a stab at?

-- 
 Magnus Hagander
 Me: http://www.hagander.net/
 Work: http://www.redpill-linpro.com/

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Bruce Momjian
Alvaro Herrera wrote:
 Bruce Momjian wrote:
  Alvaro Herrera wrote:
 
   That's too subtle.  I wouldn't figure out what it means if my life
   depended on it (then again, it doesn't).
  
  Well, official made no sense.  Bundled seemed similar enough to
  tarball.  What suggestion do you have?
 
 tarball ?

I thought tarball was rejected in the discussion:

http://archives.postgresql.org/pgsql-hackers/2009-10/msg00832.php

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Tom Lane
Jaime Casanova jcasa...@systemguards.com.ec writes:
 heikki.linnakan...@enterprisedb.com wrote:
 API would be user_process_startup(), user_process_shutdown().

 so it should be a GUC, that is settable only at start time.
 we need those integrated processes at all when in a standby server?

This seems like a solution in search of a problem to me.  The most
salient aspect of such processes is that they would necessarily run
as the postgres user, which means that you could never run any untrusted
code in them.  That cuts the space of user problems they could solve
way down.

I still haven't seen a good reason for not using cron or Task Scheduler
or other standard tools.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Recent vendor SSL renegotiation patches break PostgreSQL

2010-02-22 Thread Tom Lane
Magnus Hagander mag...@hagander.net writes:
 2010/2/22 Tom Lane t...@sss.pgh.pa.us:
 Magnus Hagander mag...@hagander.net writes:
 One way to deal with it would be to expose the whole renegotiation
 setting as a user configuratble option. So they can set *when* we
 renegotiate, which would also let them turn it off completely.
 
 Well, that might be a reasonable thing to do, because it's not just a
 temporary kluge (that we won't know when to remove) but is adding an
 arguably-useful-in-other-ways knob.

 You'd still have to turn it off on the server side if you have a
 *single* client that has the broken patch, but that's still a lot
 better than nothing.

Well, if it's a GUC it can be set per-user or per-database, so there's
at least some hope of not having to turn it off for everyone.

 Think it's worth taking a stab at?

If you want to do it, I'd be fine with it.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Jaime Casanova
On Mon, Feb 22, 2010 at 2:53 PM, Tom Lane t...@sss.pgh.pa.us wrote:

 I still haven't seen a good reason for not using cron or Task Scheduler
 or other standard tools.


- marketing? don't you hate when people say: Oracle has it!?
- user dumbness: they forgot to start daemons they need (yes, i have
seen that) or they simply don't know about them...
it's amazing the amount of people how ask me just after i tell them to
use cron or the windows task scheduler: and how i use that? Yes, in
Latin America are still very primitive... we use only those things
that are very very easy ;)

the ability to have processes that start when postmaster starts and
stop when postmaster stops is just one more way to be extensible
without integrating every piece of code into core

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Jaime Casanova
On Mon, Feb 22, 2010 at 3:08 PM, Jaime Casanova
jcasa...@systemguards.com.ec wrote:
 On Mon, Feb 22, 2010 at 2:53 PM, Tom Lane t...@sss.pgh.pa.us wrote:

 I still haven't seen a good reason for not using cron or Task Scheduler
 or other standard tools.


 - marketing? don't you hate when people say: Oracle has it!?

just before someone insult me... this comment was thought about the
in-core scheduler, something we can live without with this and still
doesn't have to hear that

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] scheduler in core

2010-02-22 Thread Merlin Moncure
On Mon, Feb 22, 2010 at 2:29 PM, Alvaro Herrera
alvhe...@commandprompt.com wrote:
 Merlin Moncure escribió:

 Like I noted above, what people want to schedule is going to be stored
 procedures.  Having both would virtually eliminate the need for
 scripting outside the database, which is a pretty big deal since
 external scripts are a real pain to keep cross platform.  Since
 there's probably a lot of overlapping problems in those two features,
 why not tackle both at once?

 Divide and conquer?

When I meant 'tackle', it is more of a 'come to an understanding'
thing.  Normally I would agree with you anyways, but I think what most
people would want to schedule would be stored procedures (sorry to
continually repeat myself here, but I really think this should be
critical to any scheduling proposal), not functions or ad hoc scripts.

merlin

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Tom Lane
Bruce Momjian br...@momjian.us writes:
 Alvaro Herrera wrote:
 Bruce Momjian wrote:
 With the attached patch, I have updated the message to use the wording
 bundled distribution.  I think the point about the snapshot tarballs
 and official releases is that they are bundled rather than pulled via
 CVS.
 
 That's too subtle.  I wouldn't figure out what it means if my life
 depended on it (then again, it doesn't).

 Well, official made no sense.  Bundled seemed similar enough to
 tarball.  What suggestion do you have?

I think bundled is a completely unhelpful choice of word.  The natural
response to reading that will be bundled with what?.  We've been using
the phraseology official distribution for years and only one person
has expressed any confusion, so I do not think you have improved
matters.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian br...@momjian.us writes:
  Alvaro Herrera wrote:
  Bruce Momjian wrote:
  With the attached patch, I have updated the message to use the wording
  bundled distribution.  I think the point about the snapshot tarballs
  and official releases is that they are bundled rather than pulled via
  CVS.
  
  That's too subtle.  I wouldn't figure out what it means if my life
  depended on it (then again, it doesn't).
 
  Well, official made no sense.  Bundled seemed similar enough to
  tarball.  What suggestion do you have?
 
 I think bundled is a completely unhelpful choice of word.  The natural
 response to reading that will be bundled with what?.  We've been using
 the phraseology official distribution for years and only one person
 has expressed any confusion, so I do not think you have improved
 matters.

The term has to cover not only official releases but the snapshot files
we create.  Can't anyone come up with a term for this?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian br...@momjian.us writes:
  Alvaro Herrera wrote:
  Bruce Momjian wrote:
  With the attached patch, I have updated the message to use the wording
  bundled distribution.  I think the point about the snapshot tarballs
  and official releases is that they are bundled rather than pulled via
  CVS.
  
  That's too subtle.  I wouldn't figure out what it means if my life
  depended on it (then again, it doesn't).
 
  Well, official made no sense.  Bundled seemed similar enough to
  tarball.  What suggestion do you have?
 
 I think bundled is a completely unhelpful choice of word.  The natural
 response to reading that will be bundled with what?.  We've been using
 the phraseology official distribution for years and only one person
 has expressed any confusion, so I do not think you have improved
 matters.

Should we just go ahead and say official releases and daily snapshots?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Reason why set-value functions not allowed in GREATEST(), etc?

2010-02-22 Thread Tom Lane
Hitoshi Harada umi.tan...@gmail.com writes:
 I just wonder why generate_series() is not allowed in GREATEST syntax.
 Looking through execQual.c,  almost all syntactic evaluations like
 COALESCE, ARRAY[], ROW() doesn't allow set-value functions. Could
 someone tell the underlying reason?

Laziness, or lack of return for the effort, or lack of desire to extend
a semantically dubious behavior even further, as you prefer.

You could support at most one set-returning input (at least without an
order of magnitude increase in complexity and creating even more room
for semantic debate), and keeping track of which one is the set would be
a PITA.  Essentially you'd need to add something of about the complexity
of ExecTargetList() to each one of those special purpose functions.

The other reason is that a lot of us think that SRFs in the targetlist
are not a feature we want to encourage anyway.  The semantics are either
dubious or outright broken depending on who you ask.  And from a
performance standpoint, adding any more complexity to execQual nodes is
not a sane thing to be doing.  What we ought to do is implement LATERAL
and tell people to move in that direction.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Tom Lane
Bruce Momjian br...@momjian.us writes:
 Should we just go ahead and say official releases and daily snapshots?

Please just revert the patch.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] What does this configure warning mean?

2010-02-22 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian br...@momjian.us writes:
  Should we just go ahead and say official releases and daily snapshots?
 
 Please just revert the patch.

So much for my trying to improve things.  Reverted.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Dimitri Fontaine
Tom Lane t...@sss.pgh.pa.us writes:
 This seems like a solution in search of a problem to me.  The most
 salient aspect of such processes is that they would necessarily run
 as the postgres user

I happen to run my PGQ tickers and londiste daemons as londiste user
and make it a superuser (at least while installing, as they need to
install some PL/C stuff). Then there's pgbouncer too, which I always run
as postgres system user, if only to be able to open a socket in the same
directory where postgres opens them (/var/run/postgresql on my system).

The precedent are archive and restore command. They do run as postgres
user too, don't they? I think we could have made walreceiver and
walsender some generic out-of-core facilities too, within this model.

The other common use case is to schedule maintenance (vacuum, cluster
some table, maintain a materialized view, backup), all of which can be
run as postgres user too, only adaptation could be to have a security
definer function.

So, out of the only scheduler use case, if you want to see some C code
that I'd like to be able to run as a postmaster's child, have a look at
pgqd, the next skytools version ticker daemon, here:

  http://github.com/markokr/skytools-dev/blob/master/sql/ticker/pgqd.c
  http://github.com/markokr/skytools-dev/blob/master/sql/ticker/ticker.c

You'll see mainly a C daemon which connects to some database and calls
stored procedures there. There could be separate schedules in fact, the
main loop for ticking the snapshots, another one for managing the retry
event queue, and yet another one for managing the maintenance
operations.


What I think I'd like to have is a user process supervisor as a
postmaster child, its job would be to start and stop the user processes
at the right time frames, and notice their death. A restart policy
should be attached to each child, which is either permanent, transient
or temporary. To avoid infinitely restarting a process, the supervisor
has 2 GUCs, supervisor_max_restarts in supervisor_max_time. Being unable
to manage a user permanent child process (worker) would trigger a
postmaster stop.

All of this is heavily inspired by the Erlang approach, which I've found
simple and effective:
  http://erlang.org/doc/man/supervisor.html

The supervised processes will have to offer a main entry point, which
will get called once the supervisor has forked, in the child process,
and must be prepared to receive SIGHUP, SIGINT and SIGTERM signals.

The setup will get done with the existing custom_variable_classes, and
more generally I guess we're reusing the PGXS and custom .so
infrastructure (shared_preload_libraries).

The main good reason to have this is to allow extension authors to
develop autonomous daemon in a portable way, benefiting from all those
efforts PostgreSQL made to have a fork() model available on windows et
al.

I guess we need a way to start the same supervised daemon extension code
more than once too, for example several pgbouncer setups on different
ports in different pooling modes.

 I still haven't seen a good reason for not using cron or Task Scheduler
 or other standard tools.

We're past the scheduler alone. You won't turn archive_command,
restore_command, walsender, walreceiver, pgbouncer or PGQ as a cron job,
but you could have them managed by the postmaster, as plugins.

Your good reason would be less code to keep an eye on :)

Back to the scheduling, you can backup the maintenance schedule with the
database itself. If all they do is call some function, which in my case
the only exception is pg_dump, then you don't need to re-validate then
when you upgrade your OS, or migrate from CentOS to debian or from
developer station running windows to production server running some Unix
variant.

Once more, nothing you couldn't implement already. Maybe PostgreSQL is
growing fast enough that now is the time to look at how to enable non
core things to be easily shipped with the core product?

Do we need a PostgreSQL distribution? I know David Wheeler's opinion on
that, and think PGAN + pg_restore friendly extensions + supervised
helper daemons will be huge enablers.

Regards,
-- 
dim

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Merlin Moncure
On Mon, Feb 22, 2010 at 2:53 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 I still haven't seen a good reason for not using cron or Task Scheduler
 or other standard tools.

*) provided and popular feature in higher end databases

*) the audience you cater to expects it

*) IMO, it should simply not be necessary to incorporate a secondary
scripting environment to do things like vacuum and backups

*) portable. for example, you can dump a database on linux and restore
to windows without re-implementing your scheduler/scripts

as a consequence,
*) off the shelf utilities/pgfoundry projects, etc can rely and
utilize scheduling behavior

merlin

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Tom Lane
Dimitri Fontaine dfonta...@hi-media.com writes:
 Tom Lane t...@sss.pgh.pa.us writes:
 This seems like a solution in search of a problem to me.  The most
 salient aspect of such processes is that they would necessarily run
 as the postgres user

 The precedent are archive and restore command. They do run as postgres
 user too, don't they?

Well, yeah, but you *must* trust those commands because every last bit
of your database content passes through their hands.  That is not an
argument why you need to trust a scheduling facility --- much less the
tasks it schedules.

I still say that every use case so far presented here would be equally
if not better served outside the database.  Putting it inside just
creates more failure scenarios and security risks.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Dimitri Fontaine
Tom Lane t...@sss.pgh.pa.us writes:
 Well, yeah, but you *must* trust those commands because every last bit
 of your database content passes through their hands.  That is not an
 argument why you need to trust a scheduling facility --- much less the
 tasks it schedules.

It seems to me that CREATE FUNCTION maintenance.foo() ... SECURITY
DEFINER means that I can schedule tasks that will not run a
superuser. On the reliability, see above.

 I still say that every use case so far presented here would be equally
 if not better served outside the database.  Putting it inside just
 creates more failure scenarios and security risks.

I can understand why you say that, but I'll have to disagree.

The fact that the database server is still available when pgbouncer
crashes, for example, still means that none of my applications are
able to connect.

When the current PGQ (or slony) code crashes, it's already C loaded code
that crashes, and it already takes PostgreSQL down with it.

I'm not the security oriented paranoid^W guy, so I won't ever try to
argue about that world, and not with you.

All in all, when the daemons I'm considering running as user processes
do crash, the fact that PostgreSQL is still alive means nothing for
me. Have its supervisor trigger a fast shutdown and restart sounds way
more reliable from here, the alternative being some alerting system
wakes me up and I get to restart the failed services while my
application is not available, but PostgreSQL is (but for no one).

Regards,
-- 
dim

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] scheduler in core

2010-02-22 Thread Alvaro Herrera
Merlin Moncure escribió:

 Like I noted above, what people want to schedule is going to be stored
 procedures.  Having both would virtually eliminate the need for
 scripting outside the database, which is a pretty big deal since
 external scripts are a real pain to keep cross platform.  Since
 there's probably a lot of overlapping problems in those two features,
 why not tackle both at once?

Divide and conquer?

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread David Christensen


On Feb 22, 2010, at 5:22 PM, Jaime Casanova wrote:


On Mon, Feb 22, 2010 at 4:37 PM, Tom Lane t...@sss.pgh.pa.us wrote:

Dimitri Fontaine dfonta...@hi-media.com writes:

Tom Lane t...@sss.pgh.pa.us writes:

This seems like a solution in search of a problem to me.  The most
salient aspect of such processes is that they would necessarily run
as the postgres user


The precedent are archive and restore command. They do run as  
postgres

user too, don't they?


Well, yeah, but you *must* trust those commands because every last  
bit

of your database content passes through their hands.  That is not an
argument why you need to trust a scheduling facility --- much less  
the

tasks it schedules.



Ok, let's forget the scheduler for a minute... this is not about that
anymore, is about having the ability to launch user processes when the
postmaster is ready to accept connections, this could be used for
launching an scheduler but also for launching other tools (ie:
pgbouncer, slon daemons, etc)


Just a few questions off the top of my head:

What are the semantics?  If you launch a process and it crashes, is  
the postmaster responsible for relaunching it?  Is there any  
additional monitoring of that process it would be expected to do?   
What defined hooks/events would you want to launch these processes  
from?  If you have to kill a backend postmaster, do the auxiliary  
processes get killed as well, and with what signal?  Are they killed  
when you stop the postmaster, and are they guaranteed to have stopped  
at this point?  Can failing to stop prevent/delay the shutdown/restart  
of the server?  Etc.


Regards,

David
--
David Christensen
End Point Corporation
da...@endpoint.com





--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] remove useless set of active snap

2010-02-22 Thread Bruce Momjian
Alvaro Herrera wrote:
 This patch removes a useless pushing of an active snapshot on
 PortalStart.  Instead of push/get/pop of the active snapshot, without
 any intervening use of the active snapshot, we just pass a local
 snapshot down to CreateQueryDesc.

Alvaro, what happened to this patch?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] commented out para in docs

2010-02-22 Thread Bruce Momjian
Andrew Dunstan wrote:
 
 
 We have this para in the CREATE TABLE docs, commented out, as shown. It 
 seems to have been like that for a long time (see 
 http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/ref/create_table.sgml?annotate=1.48).
 
 Surely we should either include it or remove it. Having it commented out 
 in the docs seems like just noise.
 
 cheers
 
 andrew
 
 
 !--
  para
   productnamePostgreSQL/ automatically allows the
  created table to inherit
   functions on tables above it in the inheritance hierarchy; that
   is, if we create table literalfoo/literal inheriting from
   literalbar/literal, then functions that accept the tuple
   type literalbar/literal can also be applied to instances of
   literalfoo/literal.  (Currently, this works reliably for
   functions on the first or only parent table, but not so well for
   functions on additional parents.)
  /para
 --

Agreed, removed.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Jaime Casanova
On Mon, Feb 22, 2010 at 4:37 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 Dimitri Fontaine dfonta...@hi-media.com writes:
 Tom Lane t...@sss.pgh.pa.us writes:
 This seems like a solution in search of a problem to me.  The most
 salient aspect of such processes is that they would necessarily run
 as the postgres user

 The precedent are archive and restore command. They do run as postgres
 user too, don't they?

 Well, yeah, but you *must* trust those commands because every last bit
 of your database content passes through their hands.  That is not an
 argument why you need to trust a scheduling facility --- much less the
 tasks it schedules.


Ok, let's forget the scheduler for a minute... this is not about that
anymore, is about having the ability to launch user processes when the
postmaster is ready to accept connections, this could be used for
launching an scheduler but also for launching other tools (ie:
pgbouncer, slon daemons, etc)

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] remove useless set of active snap

2010-02-22 Thread Alvaro Herrera
Bruce Momjian wrote:
 Alvaro Herrera wrote:
  This patch removes a useless pushing of an active snapshot on
  PortalStart.  Instead of push/get/pop of the active snapshot, without
  any intervening use of the active snapshot, we just pass a local
  snapshot down to CreateQueryDesc.
 
 Alvaro, what happened to this patch?

I dropped it because pushing the active snap is no so much a no-op
anymore (it creates a new copy), so the semantics could change.

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Alvaro Herrera
David Christensen wrote:

 What are the semantics?  If you launch a process and it crashes, is
 the postmaster responsible for relaunching it?  Is there any
 additional monitoring of that process it would be expected to do?
 What defined hooks/events would you want to launch these processes
 from?  If you have to kill a backend postmaster, do the auxiliary
 processes get killed as well, and with what signal?  Are they killed
 when you stop the postmaster, and are they guaranteed to have
 stopped at this point?  Can failing to stop prevent/delay the
 shutdown/restart of the server?  Etc.

I think most of these should be defined by the called process, i.e.
there needs to be a way to pass flags to postmaster.  For example, some
processes will need to cause a full postmaster restart, while most will
not.  For those that do, we need some robustness check; for example we
could require that they participate in the PMChildSlot mechanism.

Regarding hooks or events, I think postmaster should be kept simple:
launch at start, reset at crash recovery, kill at stop.  Salt and pepper
allowed but that's about it -- more complex ingredients are out of the
question due to added code to postmaster, which we want to be as robust
as possible and thus not able to cook much of anything else.

Now, if you run a postmaster with such a thing attached, you get no
support here on crash reports unless you can prove the crash can be
reproduced with it turned off (i.e. taint mode).

-- 
Alvaro Herrerahttp://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] 8.5 TODO: Add comments to output indicating version of pg_dump and of the database server

2010-02-22 Thread Bruce Momjian

What happened to this patch? I don't see any objections, but it was not
applied.

---

Jim Cox wrote:
 On Tue, Sep 29, 2009 at 12:00 AM, Alvaro Herrera
 alvhe...@commandprompt.com wrote:
  Jim Cox escribi?:
 
  Attached s/b a patch for the 8.5 TODO Add comments to output indicating 
  version
  of pg_dump and of the database server (pg_dump/pg_restore section, 9.2).
 
  Hmm, what happens if you do a pg_dump -Fc? ?Is this info saved anywhere
  in the dump? ?Surely if thi is useful in the text dump, it is useful in
  the binary format dumps too.
 
 (forgot to reply all)
 
 pg_restore's -l, --list print summarized TOC of the archive option
 does display the information in custom format dumps, e.g.:
 
 prompt$ /usr/local/pgsql/bin/pg_restore -l  /tmp/mytest.dump
 ;
 ; Archive created at Tue Sep 29 13:48:37 2009
 ; dbname: mytest
 ; TOC Entries: 9
 ; Compression: -1
 ; Dump Version: 1.11-0
 ; Format: CUSTOM
 ; Integer: 4 bytes
 ; Offset: 8 bytes
 ; Dumped from database version: 8.4.0
 ; Dumped by pg_dump version: 8.4.0
 
 -- 
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Issues for named/mixed function notation patch

2010-02-22 Thread Bruce Momjian

Can someone work on a patch to implement the document changes suggested
below?

---

Jeff Davis wrote:
 On Tue, 2009-09-15 at 10:51 +0200, Pavel Stehule wrote:
  My renonc, please, try new patch. I forgot mark regproc.c file.
 
 I think the documentation around calling functions is disorganized:
 
 Variadic functions, functions with defaults, SRFs, out parameters, and
 polymorphism are all explained in 34.4, which is about SQL functions
 specifically.
 
 Overloading is in chapter 34 also, but not specifically in the SQL
 function section like the rest.
 
 Function calls themselves are only given 5 lines of explanation in
 4.2.6, with no mention of things like the VARIADIC keyword.
 
 These complaints aren't about the patch, but we might want to consider
 some reorganization of those sections (probably a separate doc patch).
 
 The interaction with variadic functions appears to be misdocumented.
 From the code and tests, the VARIADIC keyword appears to be optional
 when using named notation, but required when using positional notation.
 But the documentation says:
 
 However, a named variadic argument can only be called the way shown in
 the example above. The VARIADIC keyword must not be specified and a
 variadic notation of all arguments is not supported. To use variadic
 argument lists you must use positional notation instead.
 
 What is the intended behavior? I think we should always require VARIADIC
 to be specified regardless of using named notation.
 
 I'm still reviewing the code.
 
 Regards,
   Jeff Davis
 
 
 -- 
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] numeric_to_number() function skipping some digits

2010-02-22 Thread Bruce Momjian

Added to TODO:

|Fix to_number() handling for values not matching the format string



---

Jeevan Chalke wrote:
 Hi,
 
 On Mon, Sep 21, 2009 at 12:36 PM, Brendan Jurd dire...@gmail.com wrote:
 
  2009/9/21 Jeevan Chalke jeevan.cha...@enterprisedb.com:
   Oracle returns 19-SEP-09 irrespective of the format.
   Here in PG, we have getting the proper date irrespective of the format as
   Oracle. But in the case to to_number the returned value is wrong. For
   example following query returns '340' on PG where as it returns '3450' on
   Oracle.
  
   select to_number('34,50','999,99') from dual;
  
 
  Hi Jeevan,
 
  Thanks for checking up on the Oracle behaviour.  It appears to
  silently disregard grouping characters in the format pattern, and also
  disregard them wherever they appear in the input string (or else it
  reads the string from right-to-left?).
 
 
 It seems that Oracle reads formatting string from right-to-left. Here are
 few results:
 ('number','format') == Oracle  PG
 
 ('34,50','999,99')  == 3450340
 ('34,50','99,99')   == 34503450
 ('34,50','99,999')  == Invalid Number  3450
 ('34,50','999,999') == Invalid Number  340
 
 
 
  It seems that, to match Oracle, we'd need to teach the code that 'G'
  and ',' are no-ops for to_number(), and also that such characters
  should be ignored in the input.
 
 
 That means we cannot simply ignore such characters from the input. Rather we
 can process the string R-L. But yes this will definitely going to break the
 current applications running today.
 
 
  To be honest, though, I'm not sure it's worth pursuing.  If you want
  to feed in numbers that have decorative characters all through them,
  it's far more predictable to just regex out the cruft and use ordinary
  numeric parsing than to use to_number(), which is infamous for its
  idiosyncrasies:
 
  # SELECT regexp_replace('34,50', E'[\\d.]', '', 'g')::numeric;
  3450
 
 
 This (with E'[^\\d.]') ignores/replaces all the characters except digits
 from the input which we certainly not wishing to do. Instead we can continue
 with the current implementation. But IMHO, somewhere in the time-line we
 need to fix this.
 
 
  Cheers,
  BJ
 
 
 
 Thanks
 -- 
 Jeevan B Chalke
 EnterpriseDB Software India Private Limited, Pune
 Visit us at: www.enterprisedb.com
 ---
 If better is possible, then good is not enough

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] updated hstore patch

2010-02-22 Thread Bruce Momjian
Tom Lane wrote:
 David E. Wheeler da...@kineticode.com writes:
  On Sep 20, 2009, at 8:43 AM, Tom Lane wrote:
  Yeah, this is a long-standing generic issue, and not really hstore's
  problem to fix.
 
  So then does there need to be some documentation for how to deal with  
  this, for those doing an in-place upgrade from an existing hstore data  
  type? Or would that discussion be in Bruce's tool's docs?
 
 I'm inclined to correct the existing documentation, which says at the
 bottom of http://developer.postgresql.org/pgdocs/postgres/contrib.html
 
   After a major-version upgrade of PostgreSQL, run the installation script
   again, even though the module's objects might have been brought forward
   from the old installation by dump and restore. This ensures that any new
   functions will be available and any needed corrections will be applied.
 
 That recipe doesn't actually work for cases like this.  What *would*
 work is loading the module *before* restoring from your old dump,
 then relying on the CREATEs from the incoming dump to fail.
 
 I believe we have already discussed the necessity for pg_upgrade to
 support this type of subterfuge.  A module facility would be a lot
 better of course, but we still need something for upgrading existing
 databases that don't contain the module structure.

Would someone please explain what needs to be done here?  This is the
original email but I can't figure out what to do about it:

http://archives.postgresql.org/pgsql-hackers/2009-09/msg01368.php

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [PATCH] backend: compare word-at-a-time in bcTruelen

2010-02-22 Thread Bruce Momjian
Tom Lane wrote:
 Jeremy Kerr j...@ozlabs.org writes:
  Stephen,
  If the updated function is always faster when the overall string is at
  least, say, 16 characters long,
 
  But that's not the case - the cost of the function (and the speedup from 
  the previous version) depends on the number of spaces that there are at 
  the end.
 
 Right, but there are certainly not more spaces than there are string
 characters ;-)
 
 I think Dimitri's idea is eminently worth trying.  In a string of less
 than, say, 16 bytes, the prospects of being able to win anything get
 much smaller compared to the prospects of wasting the extra loop
 overhead.  There is also a DBA psychology angle to it.  If you've got
 CHAR(n) for very small n, it's likely that the type is being used in the
 canonical fashion and there won't be many trailing blanks.  The case
 where we can hope to win is where we have CHAR(255) or some other
 plucked-from-the-air limit.

What ever happened to this patch?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Streaming replication and pg_xlogfile_name()

2010-02-22 Thread Fujii Masao
On Mon, Feb 22, 2010 at 9:30 PM, Heikki Linnakangas
heikki.linnakan...@enterprisedb.com wrote:
 Thinking about this again, I'm not sure this is a good idea. Using
 curFileTLI makes sense if you're going to call pg_xlogfile_name() and
 would expect it to return the filename of the file containing the WAL
 record being replayed. But in other contexts, it seems strange for
 pg_last_replay_timeline() to return the TLI of the first record in the
 file, rather than the actual record replayed.

Umm... though I might misunderstand your point, curFileTLI is the TLI
appearing in the name of WAL file. So it's not the TLI of the first
record in the file, isn't it?

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Elementary dependency look-up

2010-02-22 Thread Bruce Momjian

Added to TODO:

|Add function to dump pg_depend information cleanly

---

Greg Smith wrote:
 On Wed, 9 Sep 2009, decibel wrote:
 
  What might be more useful is a view that takes the guesswork out of using 
  pg_depend. Namely, convert (ref)classid into a catalog table name (or 
  better 
  yet, what type of object it is), (ref)objid into an actual object name, and 
  (ref)objsubid into a real name.
 
 Here's V1 of a depend unraveler I needed recently and that's saved me a 
 bunch of time:
 
 SELECT
c1.oid as relid,
n1.nspname || '.' || c1.relname as relation,
c1.relkind,
CASE
  WHEN c1.relkind='r' THEN 'table'
  WHEN c1.relkind='i' THEN 'index'
  WHEN c1.relkind='S' THEN 'sequence'
  WHEN c1.relkind='v' THEN 'view'
  WHEN c1.relkind='c' THEN 'composite'
  WHEN c1.relkind='t' THEN 'TOAST'
  ELSE '?'
END as kind,
c2.oid as relid,
n2.nspname || '.' || c2.relname as dependency,
c2.relkind,
CASE
  WHEN c2.relkind='r' THEN 'table'
  WHEN c2.relkind='i' THEN 'index'
  WHEN c2.relkind='S' THEN 'sequence'
  WHEN c2.relkind='v' THEN 'view'
  WHEN c2.relkind='c' THEN 'composite'
  WHEN c2.relkind='t' THEN 'TOAST'
  ELSE '?'
END as kind
 FROM
pg_depend d,
pg_class c1,
pg_namespace n1,
pg_class c2,
pg_namespace n2
 WHERE
d.objid = c1.oid AND
c1.relnamespace = n1.oid AND
n1.nspname NOT IN('information_schema', 'pg_catalog') AND
n1.nspname !~ '^pg_toast' AND
 
d.refobjid = c2.oid AND
c2.relnamespace = n2.oid AND
n2.nspname NOT IN('information_schema', 'pg_catalog') AND
n2.nspname !~ '^pg_toast' AND
 
c1.oid != c2.oid
 
 GROUP BY n1.nspname,c1.relname,c1.oid,c1.relkind,
   n2.nspname,c2.relname,c2.oid,c2.relkind
 ORDER BY n1.nspname,c1.relname;
 
 I could throw this on the Wiki as a code snippet if anyone else wanted to 
 tinker with it.
 
 --
 * Greg Smith gsm...@gregsmith.com http://www.gregsmith.com Baltimore, MD
 
 -- 
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] function side effects

2010-02-22 Thread Tatsuo Ishii
Hi,

I'm wondering if we could detect a funcion has a side effect,
i.e. does a write to database. This is neccessary for pgpool to decide
if a qeury should to be sent to all of databases or not. If a query
includes functions which do writes to database, it should send the
query to all of databases, otherwise the contents of databases go into
inconsistent state.

Currently we have three properties of functions: IMMUTABLE, STABLE and
VOLATILE. According to docs IMMUTABLE or STABLE functions do not write
to database. VOLATILE functions *may* do writes to database. Maybe I
could regard VOLATILE functions always do write, but priblem is,
VOLATILE qfunctions such as random() and timeofday() apparently do not
write and sending those queries that include such functions is
overkill.

Can we VOLATILE property divide into two categories, say, VOLATILE
without write, and VOLATILE with write?
--
Tatsuo Ishii
SRA OSS, Inc. Japan
English: http://www.sraoss.co.jp/index_en.php
Japanese: http://www.sraoss.co.jp

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] synchronous commit in dump

2010-02-22 Thread Jaime Casanova
Hi,

it's safe to set synchrounous_commit to off in a pg_dump generated
script? if yes, would this help to the performance of restore a
database?

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [SPAM][HACKERS] function side effects

2010-02-22 Thread Takahiro Itagaki

Tatsuo Ishii is...@postgresql.org wrote:

 VOLATILE functions such as random() and timeofday() apparently do not
 write and sending those queries that include such functions is
 overkill.

 Can we VOLATILE property divide into two categories, say, VOLATILE
 without write, and VOLATILE with write?

I think it's possible. We might borrow words and semantics from
unctional programming languages for functions with side effects.
How do they handle the issue?

BTW, random() *writes* the random seed, though no one will mind it.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] function side effects

2010-02-22 Thread Tom Lane
Tatsuo Ishii is...@postgresql.org writes:
 I'm wondering if we could detect a funcion has a side effect,
 i.e. does a write to database.

 Currently we have three properties of functions: IMMUTABLE, STABLE and
 VOLATILE. According to docs IMMUTABLE or STABLE functions do not write
 to database.

Those classifications are meant as planner directives; they are NOT
meant to be bulletproof.  Hanging database integrity guarantees on
whether a non volatile function changes anything is entirely unsafe.
To give just one illustration of the problems, a nonvolatile function
is allowed to call a volatile one.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] recovery.conf.sample

2010-02-22 Thread Fujii Masao
Hi,

recovery.conf.sample has the following section for Hot Standby.
Is this still required?

 #---
 # HOT STANDBY PARAMETERS
 #---
 #
 # If you want to enable read-only connections during recovery, enable
 # recovery_connections in postgresql.conf
 #
 #---


Heikki classified the recovery options into the following three
groups, in the document.

26.1. Archive recovery settings
26.2. Recovery target settings
26.3. Standby server settings

OTOH, recovery.conf.sample has classified them into the following
two groups. This is inconsistent with the document, and looks
confusing. How about modifying recovery.conf.sample to make the
grouping the same?

ARCHIVE RECOVERY PARAMETERS
LOG-STREAMING REPLICATION PARAMETERS

Regards,

-- 
Fujii Masao
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Takahiro Itagaki

Gokulakannan Somasundaram gokul...@gmail.com wrote:

 a) IOT has both table and index in one structure. So no duplication of data
 b) With visibility maps, we have three structures a) Table b) Index c)
 Visibility map. So the disk footprint of the same data will be higher in
 postgres ( 2x + size of the visibility map).
 c) More than that, inserts and updates will incur two extra random i/os
 every time. - one for updating the table and one for updating the visibility
 map.

I think IOT is a good match for overwrite storage systems, but postgres
is a non-overwrite storage systems. If we will update rows in IOT, we need
much more initial page free spaces than index-only scans where we can avoid
key updates with HOT.

Instead, how about excluding columns in primary keys from table data?
We cannot drop those primary keys and cannot seqscan the tables, but
there are no duplication of data, only small overheads (index tuple
headers and ctid links), and would work well with HOT and index-only
scans. If we don't have any non-key columns, that behaves just as IOT.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] tie user processes to postmaster was:(Re: [HACKERS] scheduler in core)

2010-02-22 Thread Tom Lane
Alvaro Herrera alvhe...@commandprompt.com writes:
 Regarding hooks or events, I think postmaster should be kept simple:
 launch at start, reset at crash recovery, kill at stop.  Salt and pepper
 allowed but that's about it -- more complex ingredients are out of the
 question due to added code to postmaster, which we want to be as robust
 as possible and thus not able to cook much of anything else.

This is exactly why I think the whole proposal is a nonstarter.  It is
necessarily pushing more complexity into the postmaster, which means
an overall reduction in system reliability.  There are some things
I'm willing to accept extra postmaster complexity for, but I say again
that not one single one of the arguments made in this thread are
convincing reasons to take that risk.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Tom Lane
Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp writes:
 Instead, how about excluding columns in primary keys from table data?

How will you implement select * from mytable ?  Or even
select * from mytable where non_primary_key = something ?
If you can't do either of those without great expense, I think
a savings on primary-key lookups is not going to be adequate
recompense.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] More robust pg_hba.conf parsing/error logging

2010-02-22 Thread Bruce Momjian
Tom Lane wrote:
 Alvaro Herrera alvhe...@commandprompt.com writes:
  Andrew Dunstan wrote:
  It will affect any dbname or username in mixed or upper case, not just
  ALL, won't it?
 
  No, I am suggesting to change only the comparisons to the literals
  all, sameuser, samegroup and samerole.

What happened to this idea?

 Hmm.  These words are effectively keywords, so +1 for treating them
 case-insensitively, as we do in SQL.  But I wonder whether there isn't
 an argument for making the comparisons of role and database names
 behave more like SQL, too --- that is FOO matches foo but not FOO.

And this one?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Adding \ev view editor?

2010-02-22 Thread Bruce Momjian

Is this a TODO?

---

Josh Berkus wrote:
 All,
 
 I've grown to adore the new \ef function editor.
 
 It doesn't seem like it would be that difficult to add a view editor as
 \ev.  While editors would also be good for other objects, I don't think
 we can do \et or \er etc. because those objects don't support CREATE OR
 REPLACE.
 
 Opinions?  Other objects which could take \e?
 
 -- 
 Josh Berkus
 PostgreSQL Experts Inc.
 www.pgexperts.com
 
 -- 
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] phypot - Pygmy Hippotause ?

2010-02-22 Thread Bruce Momjian

I assume this is not something we are supposed to apply.

---

Paul Matthews wrote:
 Kevin Grittner wrote:

  The first test seems unnecessary if you have the second.
  x = 0, so x can't be zero unless y is, too.
  Returning x on y == 0.0 will return 0.0 whenever x == 0.0.
   
  -Kevin

 Wish granted. :-)
 
 -- 
 --
 Fools ignore complexity. Pragmatists suffer it.
 Some can avoid it. Geniuses remove it.
 

 Index: src/backend/utils/adt/geo_ops.c
 ===
 RCS file: /projects/cvsroot/pgsql/src/backend/utils/adt/geo_ops.c,v
 retrieving revision 1.103
 diff -c -r1.103 geo_ops.c
 *** src/backend/utils/adt/geo_ops.c   28 Jul 2009 09:47:59 -  1.103
 --- src/backend/utils/adt/geo_ops.c   29 Aug 2009 02:47:14 -
 ***
 *** 32,37 
 --- 32,38 
* Internal routines
*/
   
 + static double phypot(double x, double y);
   static int  point_inside(Point *p, int npts, Point *plist);
   static int  lseg_crossing(double x, double y, double px, double py);
   static BOX *box_construct(double x1, double x2, double y1, double y2);
 ***
 *** 825,831 
   box_cn(a, box1);
   box_cn(b, box2);
   
 ! PG_RETURN_FLOAT8(HYPOT(a.x - b.x, a.y - b.y));
   }
   
   
 --- 826,832 
   box_cn(a, box1);
   box_cn(b, box2);
   
 ! PG_RETURN_FLOAT8(phypot(a.x-b.x, a.y-b.y));
   }
   
   
 ***
 *** 1971,1977 
   Point  *pt1 = PG_GETARG_POINT_P(0);
   Point  *pt2 = PG_GETARG_POINT_P(1);
   
 ! PG_RETURN_FLOAT8(HYPOT(pt1-x - pt2-x, pt1-y - pt2-y));
   }
   
   double
 --- 1972,1978 
   Point  *pt1 = PG_GETARG_POINT_P(0);
   Point  *pt2 = PG_GETARG_POINT_P(1);
   
 ! PG_RETURN_FLOAT8(phypot(pt1-x - pt2-x, pt1-y - pt2-y));
   }
   
   double
 ***
 *** 1979,1987 
   {
   #ifdef GEODEBUG
   printf(point_dt- segment (%f,%f),(%f,%f) length is %f\n,
 ! pt1-x, pt1-y, pt2-x, pt2-y, HYPOT(pt1-x - pt2-x, pt1-y - 
 pt2-y));
   #endif
 ! return HYPOT(pt1-x - pt2-x, pt1-y - pt2-y);
   }
   
   Datum
 --- 1980,1988 
   {
   #ifdef GEODEBUG
   printf(point_dt- segment (%f,%f),(%f,%f) length is %f\n,
 ! pt1-x, pt1-y, pt2-x, pt2-y, phypot(pt1-x - pt2-x, pt1-y - 
 pt2-y));
   #endif
 ! return phypot(pt1-x - pt2-x, pt1-y - pt2-y);
   }
   
   Datum
 ***
 *** 2444,2450 
   dist_pl_internal(Point *pt, LINE *line)
   {
   return (line-A * pt-x + line-B * pt-y + line-C) /
 ! HYPOT(line-A, line-B);
   }
   
   Datum
 --- 2445,2451 
   dist_pl_internal(Point *pt, LINE *line)
   {
   return (line-A * pt-x + line-B * pt-y + line-C) /
 ! phypot(line-A, line-B);
   }
   
   Datum
 ***
 *** 4916,4922 
   
PointPGetDatum(point)));
   result-center.x = p-x;
   result-center.y = p-y;
 ! result-radius *= HYPOT(point-x, point-y);
   
   PG_RETURN_CIRCLE_P(result);
   }
 --- 4917,4923 
   
PointPGetDatum(point)));
   result-center.x = p-x;
   result-center.y = p-y;
 ! result-radius *= phypot(point-x, point-y);
   
   PG_RETURN_CIRCLE_P(result);
   }
 ***
 *** 4936,4942 
   
PointPGetDatum(point)));
   result-center.x = p-x;
   result-center.y = p-y;
 ! result-radius /= HYPOT(point-x, point-y);
   
   PG_RETURN_CIRCLE_P(result);
   }
 --- 4937,4943 
   
PointPGetDatum(point)));
   result-center.x = p-x;
   result-center.y = p-y;
 ! result-radius /= phypot(point-x, point-y);
   
   PG_RETURN_CIRCLE_P(result);
   }
 ***
 *** 5401,5403 
 --- 5402,5465 
   
   return FALSE;
   }
 + 
 + 
 + /*- 
 +  * Determine the hypotenuse.
 +  *
 +  * If required, x and y are swapped to make x the larger number. The 
 +  * traditional formulae of x^2+y^2 is rearranged to factor x outside the
 +  * sqrt. This allows computation of the hypotenuse for significantly 
 +  * larger values, and with a higher precision than otherwise normally 
 +  * possible.
 +  *
 +  * Only arguments of  1.27e308 are at risk of causing overflow. Whereas 
 +  * the naive approach limits arguments to  9.5e153.
 +  *
 +  * sqrt( x^2 + y^2 ) = sqrt( x^2( 1 + y^2/x^2) )
 +  *   = x * sqrt( 1 + y^2/x^2 )
 +  *   = x * sqrt( 1 + y/x * y/x )
 +  *
 +  * It is expected that this routine will eventually be replaced with the
 +  * C99 hypot() function.
 +  *
 +  * This implementation conforms to IEEE Std 1003.1 and GLIBC, 

Re: [HACKERS] tie user processes to postmaster

2010-02-22 Thread Takahiro Itagaki

Jaime Casanova jcasa...@systemguards.com.ec wrote:

 integrated_user_processes = 'x, y, z'
 API would be user_process_startup(), user_process_shutdown().

FYI, pg_statsinfo version 2 emulates the same behavior with
shared_preload_libraries and spawn an user process in _PG_init().
But it's still ugly and not so reliable. Official APIs would be better.

http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/pgstatsinfo/pg_statsinfo/lib/libstatsinfo.c

It came from voices from end users that an extension should behave as
a postgres internal daemon rather than a wrapper of postgres.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] pretty print viewdefs

2010-02-22 Thread Bruce Momjian

What happened to this?  I didn't see it applied.

---

Tom Lane wrote:
 Andrew Dunstan and...@dunslane.net writes:
  OK, and how are we going to set that flag? Like I did, with a separate 
  function?
 
 I would be inclined to invent a variant of pg_get_viewdef with an
 additional parameter rather than choosing a new function name, but
 otherwise yeah.  Or we could decide this isn't worth all the
 trouble and just go back to your original patch.  By the time you
 get done with all the documentation and client-side hacking that
 would be required, this patch is going to be a lot larger than it
 seems worth.
 
  I assume you are in effect saying you don't mind if there is an 
  occasional blank line in the output.
 
 What blank line?  I would expect prettyprinting of expressions to
 sometimes insert an embedded newline, but not one at the beginning
 or end.  Do you have a counterexample?
 
   regards, tom lane
 
 -- 
 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
 To make changes to your subscription:
 http://www.postgresql.org/mailpref/pgsql-hackers

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Takahiro Itagaki

Tom Lane t...@sss.pgh.pa.us wrote:

 Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp writes:
  Instead, how about excluding columns in primary keys from table data?
 
 How will you implement select * from mytable ?  Or even
 select * from mytable where non_primary_key = something ?

Use index full scans. We can do it even for now with enable_seqscan = off.
Of course, it requires an additional step to merge index keys and heap tuples.

Also, we're using the same technique for TOASTed values. The cost can be
compared with select * from mytable where toasted_value = something, no?

 If you can't do either of those without great expense, I think
 a savings on primary-key lookups is not going to be adequate
 recompense.

I don't think it will be the default, but it would be a reasonable trade-off
for users who want IOTs, unless they often scan the whole table.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Tom Lane
Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp writes:
 Tom Lane t...@sss.pgh.pa.us wrote:
 Takahiro Itagaki itagaki.takah...@oss.ntt.co.jp writes:
 Instead, how about excluding columns in primary keys from table data?
 
 How will you implement select * from mytable ?  Or even
 select * from mytable where non_primary_key = something ?

 Also, we're using the same technique for TOASTed values. The cost can be
 compared with select * from mytable where toasted_value = something, no?

No, because toast pointers point in the direction you need to traverse.
AFAICS, this proposal involves scanning the whole index to find the
matching entry, because the available pointers link from the wrong end,
that is from the index to the table.

There are also some fairly fatal problems associated with commands like
ALTER TABLE DROP PRIMARY KEY, but I see no need to worry about that
because you haven't even made a case that there's a net performance
gain possible here.

regards, tom lane

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] A thought on Index Organized Tables

2010-02-22 Thread Takahiro Itagaki

Tom Lane t...@sss.pgh.pa.us wrote:

  Also, we're using the same technique for TOASTed values. The cost can be
  compared with select * from mytable where toasted_value = something, no?
 
 No, because toast pointers point in the direction you need to traverse.
 AFAICS, this proposal involves scanning the whole index to find the
 matching entry, because the available pointers link from the wrong end,
 that is from the index to the table.

Ah, I see there are differences if we have secondary indexes.
I misunderstood that the toast case requires scanning the whole *table* to
find the matching entry and should be compared with the whole *index* scans,
but there is another story if we have secondary indexes.

We can have indexes on toasted values, and find the related tuples
directly with CTIDs, but scans on secondary indexes on PK-excluded
tables requires not only heap tuples but also primary key values.

The secondary index issue should be considered also with the original
IOT proposal also has the same issue. Using PK-values instead of CTIDs
might require many changes in index access methods and/or the executor.

Regards,
---
Takahiro Itagaki
NTT Open Source Software Center



-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


[HACKERS] to_char(HH12) with intervals

2010-02-22 Thread Bruce Momjian
bruce wrote:
 bruce wrote:
  Dave Page wrote:
   This was posted as a documentation comment:
   
   to_char(interval '0d 0h 12m 44s', 'DD HH MI SS');
   with HH and HH12 will return 12 instead of 0.
   
   Testing on 8.4.1, it does seem to be the case that you get 00 12 12
   44. Seems bogus to me, but am I and the OP missing something?
  
  Fixed with the attached patch.  I think HH and HH24 should be the same
  for intervals.  It is hard to explain why zero hours should show as
  '12' for intervals.
 
 Oops, I needed a second patch to fix hours  12 for intervals.  Patch
 attached and applied.  It will now report the full hours of the
 interval.

We currently have this in our documentation:

functionto_char(interval)/function formats literalHH/ and
literalHH12/ as hours in a single day, while literalHH24/
can output hours exceeding a single day, e.g., gt;24.

This seems pretty confusing because HH/HH12 formats as hours in a single
1/2 day, 12 hours, and it really does wall-clock time, zero hours is 12,
and for intervals it does the right thing now and prints the interval
hours.

We also have these range definitions:

   row
entryliteralHH12/literal/entry
entryhour of day (01-12)/entry
   /row
   row
entryliteralHH24/literal/entry
entryhour of day (00-23)/entry
   /row

HH24 could always be  24 for intervals, and now HH12 can too for
intervals.

What should be changed here?

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com
  PG East:  http://www.enterprisedb.com/community/nav-pg-east-2010.do
  + If your life is a hard drive, Christ can be your backup. +

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] Streaming replication and pg_xlogfile_name()

2010-02-22 Thread Heikki Linnakangas
Fujii Masao wrote:
 On Mon, Feb 22, 2010 at 9:30 PM, Heikki Linnakangas
 heikki.linnakan...@enterprisedb.com wrote:
 Thinking about this again, I'm not sure this is a good idea. Using
 curFileTLI makes sense if you're going to call pg_xlogfile_name() and
 would expect it to return the filename of the file containing the WAL
 record being replayed. But in other contexts, it seems strange for
 pg_last_replay_timeline() to return the TLI of the first record in the
 file, rather than the actual record replayed.
 
 Umm... though I might misunderstand your point, curFileTLI is the TLI
 appearing in the name of WAL file.

Yes.

 So it's not the TLI of the first record in the file, isn't it?

Hmm, or is it the TLI of the last record? Not sure. Anyway, if there's a
TLI switch in the current WAL file, curFileTLI doesn't always represent
the TLI of the current record.

-- 
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers


Re: [HACKERS] [COMMITTERS] Re: pgsql: Speed up CREATE DATABASE by deferring the fsyncs until after

2010-02-22 Thread Andres Freund
Hi Tom,

On Tuesday 23 February 2010 06:37:26 Tom Lane wrote:
 I wrote:
  Any theories about what is happening? 
 Now, this doesn't mean that all is fine and dandy.  I believe that a
 majority of Unixen will reject attempts to open directories for writing,
 so this solution puts us even further away from being able to fsync the
 directories.  I would bet however that the platforms that reject this
 are ones that don't need fsync on directories.  Maybe we just have to
 have two different code paths depending on platform :-(
Cool.
You can't open a directory for writing under linux as well though - so that 
wont be the decisive argument. Do you have a better idea than a configure 
test?

Andres

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers