Re: [HACKERS] psycopg and two phase commit

2010-11-04 Thread Pavel Stehule
2010/11/4 Daniele Varrazzo : > On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule > wrote: >> Hello >> >> who is psycopg maintainer, please? Can somebody explains to me, why >> psycopg doesn't support twophase commit still, although some >> implementation was done in summer 2008? > > Hello Pavel, > >

Re: [HACKERS] plan time of MASSIVE partitioning ...

2010-11-04 Thread Tom Lane
[ for the archives' sake ] I wrote: > I had a thought about how to make get_tabstat_entry() faster without > adding overhead: what if we just plain remove the search, and always > assume that a new entry has to be added to the tabstat array? I spent some time looking into this idea. It doesn't r

Re: [HACKERS] timestamp of the last replayed transaction

2010-11-04 Thread Fujii Masao
On Thu, Nov 4, 2010 at 10:27 AM, Fujii Masao wrote: > On Tue, Nov 2, 2010 at 10:38 PM, Dimitri Fontaine > wrote: >> Fujii Masao writes: >>> After 9.0 release, I've often heard that some people want to know >>> how far transactions have been replayed in the standby in timestamp >>> rather than LS

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Alvaro Herrera
Excerpts from Dimitri Fontaine's message of jue nov 04 16:42:53 -0300 2010: > Alvaro Herrera writes: > > 2. I think the guts of AlterExtensionNamespace (the large switch block) > > should be elsewhere, probably in alter.c > > That's implemented in the alter_extension patch v2, and that's much > b

Re: [HACKERS] lazy snapshots?

2010-11-04 Thread Robert Haas
On Wed, Oct 20, 2010 at 8:24 PM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Oct 20, 2010 at 10:07 PM, Tom Lane wrote: >>> I'm less than convinced by the hypothesis that most transactions would >>> avoid taking snapshots in this regime, anyway.  It would only hold up >>> if there's little l

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Alvaro Herrera
Excerpts from Dimitri Fontaine's message of jue nov 04 16:39:31 -0300 2010: > Tom Lane writes: > > Not having read the patch, but ... the idea that was in the back of > > my mind was to have a generic AlterObjectNamespace function that > > would take parameters approximately like the following: >

Re: [HACKERS] lazy snapshots?

2010-11-04 Thread Robert Haas
On Thu, Nov 4, 2010 at 2:00 PM, Tom Lane wrote: > Robert Haas writes: >> On Wed, Oct 20, 2010 at 8:11 PM, Robert Haas wrote: I'm imagining that the kernel of a snapshot is just a WAL position, ie the end of WAL as of the time you take the snapshot (easy to get in O(1) time).  Visi

Re: [HACKERS] lazy snapshots?

2010-11-04 Thread Tom Lane
Robert Haas writes: > On Wed, Oct 20, 2010 at 8:11 PM, Robert Haas wrote: >>> I'm imagining that the kernel of a >>> snapshot is just a WAL position, ie the end of WAL as of the time you >>> take the snapshot (easy to get in O(1) time).  Visibility tests then >>> reduce to "did this transaction c

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Alex Hunsaker
On Thu, Nov 4, 2010 at 14:29, Alex Hunsaker wrote: > On Thu, Nov 4, 2010 at 13:43, Hannu Krosing wrote: >> So your plan was to have some savepoint before each execute ? >> >> How would one rollback the latest transaction ? > > It is always rolled back.  Its how plperl works today: > create or rep

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Alex Hunsaker
On Thu, Nov 4, 2010 at 13:43, Hannu Krosing wrote: > So your plan was to have some savepoint before each execute ? > > How would one rollback the latest transaction ? It is always rolled back. Its how plperl works today: create or replace function foo() returns int as $$ eval { spi_exec_quer

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread David E. Wheeler
On Nov 4, 2010, at 4:20 AM, Peter Eisentraut wrote: > On ons, 2010-11-03 at 14:15 -0700, David E. Wheeler wrote: >> /me wants a global $dbh that mimics the DBI interface but just uses >> SPI under the hood. Not volunteering, either… > > Already exists: DBD::PgSPI. Probably needs lots of updating

Re: [HACKERS] lazy snapshots?

2010-11-04 Thread Robert Haas
On Wed, Oct 20, 2010 at 8:11 PM, Robert Haas wrote: >> so it's >> not exploiting that resource at all.  I'm imagining that the kernel of a >> snapshot is just a WAL position, ie the end of WAL as of the time you >> take the snapshot (easy to get in O(1) time).  Visibility tests then >> reduce to "

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Hannu Krosing
On Thu, 2010-11-04 at 11:07 -0600, Alex Hunsaker wrote: > On Thu, Nov 4, 2010 at 03:54, Hannu Krosing wrote: > >> > try: > >> > plpy.execute("insert into foo values(1)") > >> > except plpy.UniqueViolation, e: > >> > plpy.notice("Ooops, you got yourself a SQLSTATE %d", e.sqlstate) > >> > >>

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Alvaro Herrera writes: > 2. I think the guts of AlterExtensionNamespace (the large switch block) > should be elsewhere, probably in alter.c That's implemented in the alter_extension patch v2, and that's much better, thanks for your continued input. Please note that it depends on the new set_schem

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Tom Lane writes: > Not having read the patch, but ... the idea that was in the back of > my mind was to have a generic AlterObjectNamespace function that > would take parameters approximately like the following: Please find attached what I came up with, that's the set_schema patch version 6. Reg

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Alex Hunsaker
On Thu, Nov 4, 2010 at 03:54, Hannu Krosing wrote: >> > try: >> >     plpy.execute("insert into foo values(1)") >> > except plpy.UniqueViolation, e: >> >     plpy.notice("Ooops, you got yourself a SQLSTATE %d", e.sqlstate) >> >> Are you sure that having each try/except use a subtransaction is the

Re: [HACKERS] psycopg and two phase commit

2010-11-04 Thread Daniele Varrazzo
On Sat, Sep 18, 2010 at 5:01 PM, Pavel Stehule wrote: > Hello > > who is psycopg maintainer, please? Can somebody explains to me, why > psycopg doesn't support twophase commit still, although some > implementation was done in summer 2008? Hello Pavel, Just wanted to warn you that I have implemen

Re: [HACKERS] Alter column to type serial

2010-11-04 Thread Alvaro Herrera
Excerpts from Thom Brown's message of jue nov 04 09:05:01 -0300 2010: > This would be instead of having to do: > > CREATE SEQUENCE id_stuff_seq; > > SELECT setval('id_stuff_seq', (SELECT max(id) FROM stuff)) > > ALTER TABLE stuff ALTER COLUMN id SET DEFAULT > nextval('id_stuff_seq'::regclass);

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Alvaro Herrera
Excerpts from Dimitri Fontaine's message of jue nov 04 11:52:53 -0300 2010: > Alvaro Herrera writes: > > 3. Not this patch, but I think using "extension" as a global variable > > name is a bad idea. > > What about create_extension_extension instead? I'm not thinking of > something better, bikesh

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Alvaro Herrera
Excerpts from Dimitri Fontaine's message of jue nov 04 11:37:37 -0300 2010: > Alvaro Herrera writes: > >> /* check for duplicate name (more friendly than unique-index failure) > >> */ > >> if (SearchSysCacheExists2(TYPENAMENSP, > >> CStringGetDatum(name), > >

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Robert Haas
On Thu, Nov 4, 2010 at 8:18 AM, Dimitri Fontaine wrote: > Robert Haas writes: >> On Thu, Nov 4, 2010 at 7:52 AM, Dimitri Fontaine >> wrote: >>> What about create_extension_extension instead? I'm not thinking of >>> something better, bikeshedding is opened. >> >> That doesn't seem very clear...

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Robert Haas writes: > On Thu, Nov 4, 2010 at 7:52 AM, Dimitri Fontaine > wrote: >> What about create_extension_extension instead? I'm not thinking of >> something better, bikeshedding is opened. > > That doesn't seem very clear... I'm always suspicious of names that > use the same word twice, an

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Tom Lane writes: > Not having read the patch, but ... the idea that was in the back of > my mind was to have a generic AlterObjectNamespace function that > would take parameters approximately like the following: > > OID of catalog containing object > Column number of catalog's namespac

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Robert Haas
On Thu, Nov 4, 2010 at 7:52 AM, Dimitri Fontaine wrote: > What about create_extension_extension instead? I'm not thinking of > something better, bikeshedding is opened. That doesn't seem very clear... I'm always suspicious of names that use the same word twice, and in this case I have no idea wha

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Alvaro Herrera writes: > 1. wouldn't it make more sense to save the extension namespace in the > extension catalog? I don't think so, because the extension itself is not schema qualified. What lives in the namespace the extension depends on is not the extension itself, but its objects. > 2. I th

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Tom Lane
Dimitri Fontaine writes: > Well, I'll go fix as you say, putting the check back into the > callers. That won't help a bit with the code duplication feeling we have > when reading the patch, though. Any idea on this front? Not having read the patch, but ... the idea that was in the back of my mind

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Alvaro Herrera
Excerpts from Dimitri Fontaine's message of jue nov 04 11:06:48 -0300 2010: > Also attached, please find the complete version of ALTER EXTENSION ext > SET SCHEMA name; with support for all contrib extensions. That's the > example that allows to see the API (AlterFooNamespace_oid and _internal > fu

Re: [HACKERS] Alter column to type serial

2010-11-04 Thread Tom Lane
Thom Brown writes: > I suspected this may have been discussed previously, I just failed to find > it. And yes, it's purely for simplification, and to auto-clean sequences > when tables are dropped. I didn't think it would be straightforward, but > clearly there are show-stoppers abound. The lat

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Alvaro Herrera writes: >> /* check for duplicate name (more friendly than unique-index failure) */ >> if (SearchSysCacheExists2(TYPENAMENSP, >> CStringGetDatum(name), >> ObjectIdGetDatum(nspOid))) > > Hmm, this check is wrong anyw

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Alvaro Herrera
Excerpts from Dimitri Fontaine's message of jue nov 04 11:06:48 -0300 2010: > Alvaro Herrera writes: > > FWIW I think you should use getObjectDescription, as in the attached > > patch. (Note the patch is incomplete and does not compile because only > > one caller to CheckSetNamespace has been fix

Re: [HACKERS] Alter column to type serial

2010-11-04 Thread Thom Brown
On 4 November 2010 14:04, Tom Lane wrote: > Thom Brown writes: > > Would it be possible (or reasonable) to add support for changing the type > of > > a column to serial or bigserial (yes, yes, I know they're not actual > > types)? > > We've looked at that in the past and decided there were enoug

Re: [HACKERS] ALTER OBJECT any_name SET SCHEMA name

2010-11-04 Thread Dimitri Fontaine
Alvaro Herrera writes: > FWIW I think you should use getObjectDescription, as in the attached > patch. (Note the patch is incomplete and does not compile because only > one caller to CheckSetNamespace has been fixed). I had to re-add the object name to the CheckSetNamespace prototype to handle t

Re: [HACKERS] Alter column to type serial

2010-11-04 Thread Tom Lane
Thom Brown writes: > Would it be possible (or reasonable) to add support for changing the type of > a column to serial or bigserial (yes, yes, I know they're not actual > types)? We've looked at that in the past and decided there were enough corner cases that it wasn't clearly a good idea. In pa

Re: [HACKERS] contrib: auth_delay module

2010-11-04 Thread Robert Haas
On Thu, Nov 4, 2010 at 6:35 AM, Stephen Frost wrote: > * Jan Urbański (wulc...@wulczer.org) wrote: >> On 04/11/10 14:09, Robert Haas wrote: >> > Hmm, I wonder how useful this is given that restriction. >> >> As KaiGai mentined, it's more to make bruteforcing difficult (read: tmie >> consuming), ri

Re: [HACKERS] contrib: auth_delay module

2010-11-04 Thread KaiGai Kohei
(2010/11/04 22:05), Itagaki Takahiro wrote: 2010/11/4 KaiGai Kohei: The attached patch is a contrib module to inject a few seconds delay on authentication failed. It is also a proof of the concept using the new ClientAuthentication_hook. This module provides a similar feature to pam_faildelay o

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Tom Lane
Hannu Krosing writes: > Are you sure that having each try/except use a subtransaction is the > right way to do it ? Actually it is not: what you have to do is use a subtransaction in the plpy.execute() operation, so that if the called SQL operation fails, you can clean it up and then report the e

Re: [HACKERS] contrib: auth_delay module

2010-11-04 Thread Stephen Frost
* Jan Urbański (wulc...@wulczer.org) wrote: > On 04/11/10 14:09, Robert Haas wrote: > > Hmm, I wonder how useful this is given that restriction. > > As KaiGai mentined, it's more to make bruteforcing difficult (read: tmie > consuming), right? Which it would still do, since the attacker would be b

Re: [HACKERS] Comparison with "true" in source code

2010-11-04 Thread Robert Haas
On Wed, Nov 3, 2010 at 6:45 PM, Itagaki Takahiro wrote: > On Wed, Nov 3, 2010 at 2:19 AM, Michael Meskes wrote: >> On Mon, Nov 01, 2010 at 12:17:02PM +0900, Itagaki Takahiro wrote: >>> There are some "== true" in the codes, but they might not be safe >>> because all non-zero values are true in C.

Re: [HACKERS] contrib: auth_delay module

2010-11-04 Thread Jan Urbański
On 04/11/10 14:09, Robert Haas wrote: > On Thu, Nov 4, 2010 at 6:05 AM, Itagaki Takahiro > wrote: >> 2010/11/4 KaiGai Kohei : >>> The attached patch is a contrib module to inject a few seconds >>> delay on authentication failed. It is also a proof of the concept >>> using the new ClientAuthenticat

Re: [HACKERS] contrib: auth_delay module

2010-11-04 Thread Robert Haas
On Thu, Nov 4, 2010 at 6:05 AM, Itagaki Takahiro wrote: > 2010/11/4 KaiGai Kohei : >> The attached patch is a contrib module to inject a few seconds >> delay on authentication failed. It is also a proof of the concept >> using the new ClientAuthentication_hook. >> >> This module provides a similar

Re: [HACKERS] contrib: auth_delay module

2010-11-04 Thread Itagaki Takahiro
2010/11/4 KaiGai Kohei : > The attached patch is a contrib module to inject a few seconds > delay on authentication failed. It is also a proof of the concept > using the new ClientAuthentication_hook. > > This module provides a similar feature to pam_faildelay on > operating systems. Injection of a

[HACKERS] contrib: auth_delay module

2010-11-04 Thread KaiGai Kohei
The attached patch is a contrib module to inject a few seconds delay on authentication failed. It is also a proof of the concept using the new ClientAuthentication_hook. This module provides a similar feature to pam_faildelay on operating systems. Injection of a few seconds delay on authentication

Re: [HACKERS] Hash support for arrays

2010-11-04 Thread Kenneth Marshall
On Thu, Nov 04, 2010 at 10:00:40AM +, Dean Rasheed wrote: > On 3 November 2010 09:24, Nicolas Barbier wrote: > > 2010/11/2 Kenneth Marshall : > > > >> Given that our hash implimentation mixes the input data well (It does. > >> I tested it.) then a simple rotate-and-xor method is all that shoul

[HACKERS] Alter column to type serial

2010-11-04 Thread Thom Brown
Hi all, Would it be possible (or reasonable) to add support for changing the type of a column to serial or bigserial (yes, yes, I know they're not actual types)? In effect this would mean that users who forgot to set up a sequence could change it's type so that a new implicit sequence will be cre

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Peter Eisentraut
On ons, 2010-11-03 at 14:15 -0700, David E. Wheeler wrote: > /me wants a global $dbh that mimics the DBI interface but just uses > SPI under the hood. Not volunteering, either… Already exists: DBD::PgSPI. Probably needs lots of updating through. -- Sent via pgsql-hackers mailing list (pgsql-ha

Re: [HACKERS] Hash support for arrays

2010-11-04 Thread Dean Rasheed
On 3 November 2010 09:24, Nicolas Barbier wrote: > 2010/11/2 Kenneth Marshall : > >> Given that our hash implimentation mixes the input data well (It does. >> I tested it.) then a simple rotate-and-xor method is all that should >> be needed to maintain all of the needed information. The original >

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Hannu Krosing
On Thu, 2010-11-04 at 11:46 +0200, Hannu Krosing wrote: > On Wed, 2010-11-03 at 21:43 +0100, Jan Urbański wrote: > > The validator is ready, once I'm done with the hash tables I'll try to > > fix up the error checking (get rid of the global error state) and > > finally do what started it all, that

Re: [HACKERS] why does plperl cache functions using just a bool for is_trigger

2010-11-04 Thread Hannu Krosing
On Wed, 2010-11-03 at 21:43 +0100, Jan Urbański wrote: > The validator is ready, once I'm done with the hash tables I'll try to > fix up the error checking (get rid of the global error state) and > finally do what started it all, that is make plpythonu use > subtransactions for SPI and be able to d

Re: [HACKERS] SQL/MED estimated time of arrival?

2010-11-04 Thread Itagaki Takahiro
On Thu, Nov 4, 2010 at 6:04 PM, Shigeru HANADA wrote: > For example: > * PRIMARY ACCESS_METHOD -> HANDLER of FOREIGN DATA WRAPPER > * am_scancost()         -> FdwRoutine.EstimateCosts() > * am_open()             -> FdwRoutine.Open() > * am_beginscan()        -> first call of FdwRoutine.Iterate()?

Re: [HACKERS] SQL/MED estimated time of arrival?

2010-11-04 Thread Shigeru HANADA
On Wed, 03 Nov 2010 13:32:18 -0700 Eric Davies wrote: > On Informix, we were able to take advantage of the VTI (Virtual Table > Interface) feature to support "table" scans and indexing. (See > http://www.ibm.com/developerworks/data/zones/informix/library/techarticle/db_vti.html > > .) Do you h