Re: [HACKERS] "cannot specify finite value after UNBOUNDED" ... uh, why?

2017-05-30 Thread Robert Haas
On Tue, May 30, 2017 at 11:03 AM, Tom Lane  wrote:
> Robert Haas  writes:
>> On Mon, May 29, 2017 at 3:04 AM, Tom Lane  wrote:
>>> Would someone please defend the restrictions imposed by the
>>> "seen_unbounded" checks in transformPartitionBound
>>> (parse_utilcmd.c:3365..3396 in current HEAD)?
>
>> Because this is supposed to work more or less like row-comparison --
>> the earlier columns are strictly more significant than the later ones.
>> That is, allowing (1, 2) through (3, 4) allows (2, whatever) but (1,
>> y) only if y >= 2 and (3, y) only if y < 4.
>
> I see.  That makes the logic awfully complex though.  I was looking
> at get_qual_for_range() yesterday --- it's mind-bendingly complicated
> and I have next to no faith that it's 100% right.

It might be useful if somebody would be willing to put together a
fuzz-tester for it.  Like, randomly generate partition bounds over
various different data types, and then verify that each tuple is
accepted by the partition constraint of only one partition and that
it's the same partition into which tuple routing tries to put it.

>> In case you're wondering, this is also how a certain large commercial
>> database system interprets composite bounds.  You could imagine in
>> theory a system where a bound from (1, 2) to (3, 4) allows only those
>> (x, y) where 1<=x<3 and 2<=y<4 but I know of no existing system that
>> does anything like that.  If you want that sort of thing, you can get
>> it anyway using two levels of partitioning, one on each column.
>
> Well, if we just treated each column independently, you could get
> the row-comparison behavior by partitioning on a ROW() expression.
> So that argument doesn't impress me.  I suppose compatibility with
> other partitioning implementations is worth something, but I'm not
> sure it's worth this much complication and risk of bugs.

I guess you won't be terribly surprised to hear that I think
compatibility with other implementations is quite desirable.  I also
think that Amit and others who have been involved in the discussions
have the same opinion, although of course they can speak for
themselves.  In terms of partitioning on a ROW() expression, I believe
that you would lose the ability to control which opclass and collation
is used for each column, which I think is something that people care
about.  Also, I bet it would be slower.  Also, I bet the syntax would
be less intuitive.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] "cannot specify finite value after UNBOUNDED" ... uh, why?

2017-05-30 Thread Tom Lane
Robert Haas  writes:
> On Mon, May 29, 2017 at 3:04 AM, Tom Lane  wrote:
>> Would someone please defend the restrictions imposed by the
>> "seen_unbounded" checks in transformPartitionBound
>> (parse_utilcmd.c:3365..3396 in current HEAD)?

> Because this is supposed to work more or less like row-comparison --
> the earlier columns are strictly more significant than the later ones.
> That is, allowing (1, 2) through (3, 4) allows (2, whatever) but (1,
> y) only if y >= 2 and (3, y) only if y < 4.

I see.  That makes the logic awfully complex though.  I was looking
at get_qual_for_range() yesterday --- it's mind-bendingly complicated
and I have next to no faith that it's 100% right.

> In case you're wondering, this is also how a certain large commercial
> database system interprets composite bounds.  You could imagine in
> theory a system where a bound from (1, 2) to (3, 4) allows only those
> (x, y) where 1<=x<3 and 2<=y<4 but I know of no existing system that
> does anything like that.  If you want that sort of thing, you can get
> it anyway using two levels of partitioning, one on each column.

Well, if we just treated each column independently, you could get
the row-comparison behavior by partitioning on a ROW() expression.
So that argument doesn't impress me.  I suppose compatibility with
other partitioning implementations is worth something, but I'm not
sure it's worth this much complication and risk of bugs.

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] "cannot specify finite value after UNBOUNDED" ... uh, why?

2017-05-30 Thread Robert Haas
On Mon, May 29, 2017 at 3:04 AM, Tom Lane  wrote:
> Would someone please defend the restrictions imposed by the
> "seen_unbounded" checks in transformPartitionBound
> (parse_utilcmd.c:3365..3396 in current HEAD)?  They sure look to me like
> nothing but sloppy thinking, and/or protection of downstream sloppy
> thinking.  Why should the boundedness of one partitioning column's
> range matter to any other partitioning column's range?

Because this is supposed to work more or less like row-comparison --
the earlier columns are strictly more significant than the later ones.
That is, allowing (1, 2) through (3, 4) allows (2, whatever) but (1,
y) only if y >= 2 and (3, y) only if y < 4.

In case you're wondering, this is also how a certain large commercial
database system interprets composite bounds.  You could imagine in
theory a system where a bound from (1, 2) to (3, 4) allows only those
(x, y) where 1<=x<3 and 2<=y<4 but I know of no existing system that
does anything like that.  If you want that sort of thing, you can get
it anyway using two levels of partitioning, one on each column.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] "cannot specify finite value after UNBOUNDED" ... uh, why?

2017-05-29 Thread Amit Langote
On 2017/05/29 16:04, Tom Lane wrote:
> Would someone please defend the restrictions imposed by the
> "seen_unbounded" checks in transformPartitionBound
> (parse_utilcmd.c:3365..3396 in current HEAD)?  They sure look to me like
> nothing but sloppy thinking, and/or protection of downstream sloppy
> thinking.  Why should the boundedness of one partitioning column's
> range matter to any other partitioning column's range?

If an earlier column's value is unbounded per the bound specification of a
range partition, later columns of an input row would never be compared
against their respective partition bounds, because the row's partition key
would trivially have been determined to be greater or less than the
partition's lower or upper bound, respectively, based on the comparison
against aforementioned unbounded column's infinite value.  Note that it's
the row comparison logic at work here.

Having said that, having finite values after an unbounded value doesn't
really affect tuple-routing code per se (which is what the above paragraph
is meant to describe the actions of), but it does affect the code that
creates constraint expression from the relpartbound value of a range
partition, at least because of the way get_qual_for_range() implements it.

If we had allowed them, an incorrect constraint expression would result as
illustrated below; consider a range partition:

create table foo (a int, b int) partition by range (a, b);
create table foo1 partition of foo for values in (unbounded, -1) to
(unbounded, 1);

foo1, as defined above, basically accepts any row with non-null a, if
inserted through foo via tuple-routing, because any non-null value of a is
trivially >= -infinity and < +infinity.

But, get_qual_for_range() would end up returning an expression that looks
like:

(b >= -1) and (b < 1)

which means that (2, 1) would fail to be inserted directly into foo1 due
to the above constraint, even if inserting it through foo would work,
because column b would not be considered in the latter.

Maybe there is a way to rewrite the code that generates the constraint
expression to somehow not emit the above expression, but any new code to
accomplish that might be more complicated than it is now.

See the following message:

https://www.postgresql.org/message-id/CA%2BTgmoYWnV2GMnYLG-Czsix-E1WGAbo4D%2B0tx7t9NdfYBDMFsA%40mail.gmail.com

I tend to agree with what Robert said there in the first part; there is no
point in allowing finite values to be specified after the last UNBOUNDED
in FROM and TO lists, which might mislead the user to believe that they
are actually significant.

Thanks,
Amit



-- 
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] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-03-08 Thread Fujii Masao
On Wed, Mar 8, 2017 at 9:05 PM, Masahiko Sawada  wrote:
> On Wed, Feb 8, 2017 at 12:04 AM, Fujii Masao  wrote:
>> On Tue, Feb 7, 2017 at 2:13 AM, Petr Jelinek
>>  wrote:
>>> On 06/02/17 17:33, Fujii Masao wrote:
 On Sun, Feb 5, 2017 at 5:11 AM, Petr Jelinek
  wrote:
> On 03/02/17 19:38, Fujii Masao wrote:
>> On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  
>> wrote:
>>> On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
>>>  wrote:
 At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  
 wrote in 
 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-03-08 Thread Masahiko Sawada
On Wed, Feb 8, 2017 at 12:04 AM, Fujii Masao  wrote:
> On Tue, Feb 7, 2017 at 2:13 AM, Petr Jelinek
>  wrote:
>> On 06/02/17 17:33, Fujii Masao wrote:
>>> On Sun, Feb 5, 2017 at 5:11 AM, Petr Jelinek
>>>  wrote:
 On 03/02/17 19:38, Fujii Masao wrote:
> On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  
> wrote:
>> On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
>>  wrote:
>>> At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  
>>> wrote in 
>>> 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-08 Thread Robert Haas
On Sat, Feb 4, 2017 at 3:11 PM, Petr Jelinek
 wrote:
> That was the reason why DropSubscription didn't release the lock in the
> first place. It was supposed to be released at the end of the
> transaction though.

Holding an LWLock until end-of-transaction is a phenomenally bad idea,
both because you lose interruptibility and because of the deadlock
risk.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-07 Thread Fujii Masao
On Tue, Feb 7, 2017 at 2:13 AM, Petr Jelinek
 wrote:
> On 06/02/17 17:33, Fujii Masao wrote:
>> On Sun, Feb 5, 2017 at 5:11 AM, Petr Jelinek
>>  wrote:
>>> On 03/02/17 19:38, Fujii Masao wrote:
 On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  wrote:
> On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
>  wrote:
>> At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  
>> wrote in 
>> 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-06 Thread Petr Jelinek
On 06/02/17 17:33, Fujii Masao wrote:
> On Sun, Feb 5, 2017 at 5:11 AM, Petr Jelinek
>  wrote:
>> On 03/02/17 19:38, Fujii Masao wrote:
>>> On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  wrote:
 On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
  wrote:
> At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  
> wrote in 
> 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-06 Thread Fujii Masao
On Sun, Feb 5, 2017 at 5:11 AM, Petr Jelinek
 wrote:
> On 03/02/17 19:38, Fujii Masao wrote:
>> On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  wrote:
>>> On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
>>>  wrote:
 At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  
 wrote in 
 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-04 Thread Petr Jelinek
On 03/02/17 19:38, Fujii Masao wrote:
> On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  wrote:
>> On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
>>  wrote:
>>> At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  
>>> wrote in 
>>> 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-03 Thread Fujii Masao
On Sat, Feb 4, 2017 at 12:49 AM, Fujii Masao  wrote:
> On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
>  wrote:
>> At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  wrote 
>> in 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-03 Thread Fujii Masao
On Fri, Feb 3, 2017 at 10:56 AM, Kyotaro HORIGUCHI
 wrote:
> At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  wrote 
> in 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-02 Thread Kyotaro HORIGUCHI
At Fri, 3 Feb 2017 01:02:47 +0900, Fujii Masao  wrote in 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-02 Thread Fujii Masao
On Thu, Feb 2, 2017 at 2:36 PM, Michael Paquier
 wrote:
> On Thu, Feb 2, 2017 at 2:13 PM, Tom Lane  wrote:
>> Kyotaro HORIGUCHI  writes:
>>> Then, the reason for the TRY-CATCH cluase is that I found that
>>> some functions called from there can throw exceptions.
>>
>> Yes, but all LWLocks should be released by normal error recovery.
>> It should not be necessary for this code to clean that up by hand.
>> If it were necessary, there would be TRY-CATCH around every single
>> LWLockAcquire in the backend, and we'd have an unreadable and
>> unmaintainable system.  Please don't add a TRY-CATCH unless it's
>> *necessary* -- and you haven't explained why this one is.

Yes.

> Putting hands into the code and at the problem, I can see that
> dropping a subscription on a node makes it unresponsive in case of a
> stop. And that's just because calls to LWLockRelease are missing as in
> the patch attached. A try/catch problem should not be necessary.

Thanks for the patch!

With the patch, LogicalRepLauncherLock is released at the end of
DropSubscription(). But ISTM that the lock should be released just after
logicalrep_worker_stop() and there is no need to protect the removal of
replication slot with the lock.

/*
* If we found worker but it does not have proc set it is starting up,
* wait for it to finish and then kill it.
*/
while (worker && !worker->proc)
{

ISTM that the above loop in logicalrep_worker_stop() is not necessary
because LogicalRepLauncherLock ensures that the above condition is
always false. Thought? Am I missing something?

If the above condition is true, which means that there is the worker slot
having the "subid" of the worker to kill, but its "proc" has not been set yet.
Without LogicalRepLauncherLock, this situation can happen after "subid"
is set by the launcher and before "proc" is set by the worker. But
LogicalRepLauncherLock protects those operations, so logicalrep_worker_stop()
called while holding the lock should always think the above condition is false.

Regards,

-- 
Fujii Masao


-- 
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] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-01 Thread Michael Paquier
On Thu, Feb 2, 2017 at 2:13 PM, Tom Lane  wrote:
> Kyotaro HORIGUCHI  writes:
>> Then, the reason for the TRY-CATCH cluase is that I found that
>> some functions called from there can throw exceptions.
>
> Yes, but all LWLocks should be released by normal error recovery.
> It should not be necessary for this code to clean that up by hand.
> If it were necessary, there would be TRY-CATCH around every single
> LWLockAcquire in the backend, and we'd have an unreadable and
> unmaintainable system.  Please don't add a TRY-CATCH unless it's
> *necessary* -- and you haven't explained why this one is.

Putting hands into the code and at the problem, I can see that
dropping a subscription on a node makes it unresponsive in case of a
stop. And that's just because calls to LWLockRelease are missing as in
the patch attached. A try/catch problem should not be necessary.
-- 
Michael


drop-subs-locks.patch
Description: Binary data

-- 
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] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-01 Thread Tom Lane
Kyotaro HORIGUCHI  writes:
> Then, the reason for the TRY-CATCH cluase is that I found that
> some functions called from there can throw exceptions.

Yes, but all LWLocks should be released by normal error recovery.
It should not be necessary for this code to clean that up by hand.
If it were necessary, there would be TRY-CATCH around every single
LWLockAcquire in the backend, and we'd have an unreadable and
unmaintainable system.  Please don't add a TRY-CATCH unless it's
*necessary* -- and you haven't explained why this one is.

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] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-01 Thread Kyotaro HORIGUCHI
At Thu, 2 Feb 2017 08:46:11 +0900, Michael Paquier  
wrote in 
> On Thu, Feb 2, 2017 at 2:14 AM, Fujii Masao  wrote:
> > The lwlock would be released when an exception occurs, so I don't think
> > that TRY-CATCH is necessary here. Or it's necessary for another reason?
> 
> +PG_CATCH();
> +{
> +LWLockRelease(LogicalRepLauncherLock);
> +PG_RE_THROW();
> +}
> +PG_END_TRY();
> Just to do that, a TRY/CATCH block looks like an overkill to me. Why
> not just call LWLockRelease in the ERROR and return code paths?

I though the same first. The modification at the "if (wrconn =="
is the remains of that. It is reverted inthe attached patch.

Then, the reason for the TRY-CATCH cluase is that I found that
some functions called from there can throw exceptions.

logicalrep_worker_stop and replorigin_drop have ereport in its path.
load_library apparently can throw exception.
(walrcv_(libpq_) functions don't seeem to.)

regards,

-- 
Kyotaro Horiguchi
NTT Open Source Software Center
>From d0ca653bb2aa776742a2e7a697b02794b1ad66d9 Mon Sep 17 00:00:00 2001
From: Kyotaro Horiguchi 
Date: Thu, 2 Feb 2017 11:33:40 +0900
Subject: [PATCH] Fix DROP SUBSCRIPTION's lock leak.

DROP SUBSCRIPTION acquires a lock on LogicalRepLauncherLock but never
releases. This fixes it.
---
 src/backend/commands/subscriptioncmds.c | 86 ++---
 1 file changed, 48 insertions(+), 38 deletions(-)

diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index 5de..223eea4 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -511,52 +511,62 @@ DropSubscription(DropSubscriptionStmt *stmt)
 	/* Protect against launcher restarting the worker. */
 	LWLockAcquire(LogicalRepLauncherLock, LW_EXCLUSIVE);
 
-	/* Kill the apply worker so that the slot becomes accessible. */
-	logicalrep_worker_stop(subid);
-
-	/* Remove the origin tracking if exists. */
-	snprintf(originname, sizeof(originname), "pg_%u", subid);
-	originid = replorigin_by_name(originname, true);
-	if (originid != InvalidRepOriginId)
-		replorigin_drop(originid);
-
-	/* If the user asked to not drop the slot, we are done mow.*/
-	if (!stmt->drop_slot)
-	{
-		heap_close(rel, NoLock);
-		return;
-	}
-
 	/*
-	 * Otherwise drop the replication slot at the publisher node using
-	 * the replication connection.
+	 * Some functions called here can throw exceptions. we must release
+	 * LogicalRepLauncherLock for the case.
 	 */
-	load_file("libpqwalreceiver", false);
+	PG_TRY();
+	{
+		/* Kill the apply worker so that the slot becomes accessible. */
+		logicalrep_worker_stop(subid);
 
-	initStringInfo();
-	appendStringInfo(, "DROP_REPLICATION_SLOT \"%s\"", slotname);
+		/* Remove the origin tracking if exists. */
+		snprintf(originname, sizeof(originname), "pg_%u", subid);
+		originid = replorigin_by_name(originname, true);
+		if (originid != InvalidRepOriginId)
+			replorigin_drop(originid);
 
-	wrconn = walrcv_connect(conninfo, true, subname, );
-	if (wrconn == NULL)
-		ereport(ERROR,
-(errmsg("could not connect to publisher when attempting to "
-		"drop the replication slot \"%s\"", slotname),
- errdetail("The error was: %s", err)));
+		/* Do the follwoing only if the user asked to actually drop the slot */
+		if (stmt->drop_slot)
+		{
+			/*
+			 * Drop the replication slot at the publisher node using the
+			 * replication connection.
+			 */
+			load_file("libpqwalreceiver", false);
 
-	if (!walrcv_command(wrconn, cmd.data, ))
-		ereport(ERROR,
-(errmsg("could not drop the replication slot \"%s\" on publisher",
-		slotname),
- errdetail("The error was: %s", err)));
-	else
-		ereport(NOTICE,
-(errmsg("dropped replication slot \"%s\" on publisher",
-		slotname)));
+			initStringInfo();
+			appendStringInfo(, "DROP_REPLICATION_SLOT \"%s\"", slotname);
+
+			wrconn = walrcv_connect(conninfo, true, subname, );
+			if (wrconn == NULL)
+ereport(ERROR,
+		(errmsg("could not connect to publisher when attempting to "
+"drop the replication slot \"%s\"", slotname),
+		 errdetail("The error was: %s", err)));
 
-	walrcv_disconnect(wrconn);
+			else if (!walrcv_command(wrconn, cmd.data, ))
+ereport(ERROR,
+		(errmsg("could not drop the replication slot \"%s\" on publisher",
+slotname),
+		 errdetail("The error was: %s", err)));
+
+			ereport(NOTICE,
+	(errmsg("dropped replication slot \"%s\" on publisher",
+			slotname)));
 
-	pfree(cmd.data);
+			walrcv_disconnect(wrconn);
+			pfree(cmd.data);
+		}
+	}
+	PG_CATCH();
+	{
+		LWLockRelease(LogicalRepLauncherLock);
+		PG_RE_THROW();
+	}
+	PG_END_TRY();
 
+	LWLockRelease(LogicalRepLauncherLock);
 	heap_close(rel, NoLock);
 }
 
-- 
2.9.2


-- 
Sent via pgsql-hackers mailing list 

Re: [HACKERS] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-01 Thread Michael Paquier
On Thu, Feb 2, 2017 at 2:14 AM, Fujii Masao  wrote:
> The lwlock would be released when an exception occurs, so I don't think
> that TRY-CATCH is necessary here. Or it's necessary for another reason?

+PG_CATCH();
+{
+LWLockRelease(LogicalRepLauncherLock);
+PG_RE_THROW();
+}
+PG_END_TRY();
Just to do that, a TRY/CATCH block looks like an overkill to me. Why
not just call LWLockRelease in the ERROR and return code paths?
-- 
Michael


-- 
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] Cannot shutdown subscriber after DROP SUBSCRIPTION

2017-02-01 Thread Fujii Masao
On Wed, Feb 1, 2017 at 5:36 PM, Kyotaro HORIGUCHI
 wrote:
> Hello, while looking another bug, I found that standby cannot
> shutdown after DROP SUBSCRIPTION.
>
> standby=# CREATE SUBSCRPTION sub1 ...
> standby=# 
> standby=# DROP SUBSCRIPTION sub1;
>
> Ctrl-C to the standby fails to work. ApplyLauncherMain is waiting
> LogicalRepLauncherLock forever.
>
> The culprit is DropSbuscription. It acquires
> LogicalRepLauncherLock but never releases.
>
> The attached patch fixes it. Most part of the fucntion is now
> enclosed by PG_TRY-CATCH since some functions can throw
> exceptions.

The lwlock would be released when an exception occurs, so I don't think
that TRY-CATCH is necessary here. Or it's necessary for another reason?

Regards,

-- 
Fujii Masao


-- 
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] Cannot find a working 64-bit integer type

2016-01-18 Thread Robert Haas
On Sun, Jan 17, 2016 at 5:45 PM, Igal @ Lucee.org  wrote:
> UPDATE: when I ran: configure --without-zlib --enable-debug
> CFLAGS="-Wno-cpp"
>
> I did not get an error from configure (though I get an error from "make" but
> that's another issue)
>
> I'm not sure what I'm "losing" by passing the "no-cpp" compiler flag?

According to 'man gcc':

   -Wno-cpp
   (C, Objective-C, C++, Objective-C++ and Fortran only)

   Suppress warning messages emitted by "#warning" directives.

So apparently on your system configure fails the test for a 64-bit
integer type because a #warning is emitted, and compiling with
-Wno-cpp gets rid of that (probably without breaking anything else).
The relevant portion of config.log seems to be this:

configure:13285: gcc -o conftest.exe -Wall -Wmissing-prototypes
-Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
-fwrapv -fexcess-precision=standard -O2
-I/home/Admin/sources/postgresql-9.5.0/src/include/port/win32
-DEXEC_BACKEND -Wl,--allow-multiple-definition
-Wl,--disable-auto-import conftest.c -lz -lws2_32 -lm >&5
conftest.c:106:5: warning: no previous prototype for 'does_int64_work'
[-Wmissing-prototypes] int does_int64_work()
conftest.c:120:1: warning: return type defaults to 'int' [-Wimplicit-int]
conftest.c: In function 'main':
conftest.c:121:3: warning: implicit declaration of function 'exit'
[-Wimplicit-function-declaration]
conftest.c:121:3: warning: incompatible implicit declaration of
built-in function 'exit'
conftest.c:121:3: note: include '' or provide a declaration of 'exit'
C:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
reopening conftest.exe: Permission denied
C:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
final link failed: Permission denied collect2.exe: error: ld returned
1 exit status
configure:13285: $? = 1 configure: program exited with status 1

I'm a little confused as to why -Wno-cpp fixes any of that, though.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] Cannot find a working 64-bit integer type

2016-01-18 Thread Tom Lane
Robert Haas  writes:
> The relevant portion of config.log seems to be this:

> configure:13285: gcc -o conftest.exe -Wall -Wmissing-prototypes
> -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
> -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing
> -fwrapv -fexcess-precision=standard -O2
> -I/home/Admin/sources/postgresql-9.5.0/src/include/port/win32
> -DEXEC_BACKEND -Wl,--allow-multiple-definition
> -Wl,--disable-auto-import conftest.c -lz -lws2_32 -lm >&5
> conftest.c:106:5: warning: no previous prototype for 'does_int64_work'
> [-Wmissing-prototypes] int does_int64_work()
> conftest.c:120:1: warning: return type defaults to 'int' [-Wimplicit-int]
> conftest.c: In function 'main':
> conftest.c:121:3: warning: implicit declaration of function 'exit'
> [-Wimplicit-function-declaration]
> conftest.c:121:3: warning: incompatible implicit declaration of
> built-in function 'exit'
> conftest.c:121:3: note: include '' or provide a declaration of 
> 'exit'
> C:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
> reopening conftest.exe: Permission denied
> C:/Apps/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/5.3.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
> final link failed: Permission denied collect2.exe: error: ld returned
> 1 exit status
> configure:13285: $? = 1 configure: program exited with status 1

I do not think configure pays attention to mere warnings for this type of
test.  The real problem here seems to be the "permission denied" errors,
which to me reek of broken Windows antivirus software.  (As far as I'm
aware, the word "broken" is redundant in that phrase.)

> I'm a little confused as to why -Wno-cpp fixes any of that, though.

Most likely, it's pure chance that a retry worked.  Or if it's repeatable,
maybe no-cpp changes the compiler's file access patterns enough that
there's no longer a false trip of the AV check.

Short answer is that I wonder how much of the OP's multiple problems
are being caused by AV bugs.

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] Cannot find a working 64-bit integer type

2016-01-18 Thread Igal @ Lucee.org

On 1/18/2016 11:09 AM, Tom Lane wrote:

Robert Haas  writes:

The relevant portion of config.log seems to be this:
I do not think configure pays attention to mere warnings for this type 
of test. The real problem here seems to be the "permission denied" 
errors, which to me reek of broken Windows antivirus software. (As far 
as I'm aware, the word "broken" is redundant in that phrase.)
Thank you both for looking into this.  The only A/V-type software that I 
have running is the "Microsoft Security Essentials".



I'm a little confused as to why -Wno-cpp fixes any of that, though.

Most likely, it's pure chance that a retry worked.  Or if it's repeatable,
maybe no-cpp changes the compiler's file access patterns enough that
there's no longer a false trip of the AV check.

Short answer is that I wonder how much of the OP's multiple problems
are being caused by AV bugs.
I did not make any changes other than adding the compiler flags between 
those two runs (nor afterwards).


The reason that I decided to try to add the -Wno-error flag was that I 
searched the net for the error message, and found this
thread from 4 years ago: 
http://postgresql.nabble.com/Setting-Werror-in-CFLAGS-td5118384.html -- 
which showed

a similar error message and a play of the compiler flags.

I will try to run both forms again and report whether it is repeatable.

Thanks again,


Igal



--
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] Cannot find a working 64-bit integer type

2016-01-18 Thread Igal @ Lucee.org

It looks like Tom is correct.

I added the directory tree to an exclude list of Microsoft Security 
Essentials and

ran `configure` without any flags and it completed successfully this time.

Thank you both for your time and expertise,


Igal

On 1/18/2016 11:23 AM, Igal @ Lucee.org wrote:

On 1/18/2016 11:09 AM, Tom Lane wrote:

Robert Haas  writes:

The relevant portion of config.log seems to be this:
I do not think configure pays attention to mere warnings for this 
type of test. The real problem here seems to be the "permission 
denied" errors, which to me reek of broken Windows antivirus 
software. (As far as I'm aware, the word "broken" is redundant in 
that phrase.)
Thank you both for looking into this.  The only A/V-type software that 
I have running is the "Microsoft Security Essentials".



I'm a little confused as to why -Wno-cpp fixes any of that, though.
Most likely, it's pure chance that a retry worked.  Or if it's 
repeatable,

maybe no-cpp changes the compiler's file access patterns enough that
there's no longer a false trip of the AV check.

Short answer is that I wonder how much of the OP's multiple problems
are being caused by AV bugs.
I did not make any changes other than adding the compiler flags 
between those two runs (nor afterwards).


The reason that I decided to try to add the -Wno-error flag was that I 
searched the net for the error message, and found this
thread from 4 years ago: 
http://postgresql.nabble.com/Setting-Werror-in-CFLAGS-td5118384.html 
-- which showed

a similar error message and a play of the compiler flags.

I will try to run both forms again and report whether it is repeatable.

Thanks again,


Igal





--
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] Cannot find a working 64-bit integer type

2016-01-18 Thread Robert Haas
On Mon, Jan 18, 2016 at 2:42 PM, Igal @ Lucee.org  wrote:
> It looks like Tom is correct.
>
> I added the directory tree to an exclude list of Microsoft Security
> Essentials and
> ran `configure` without any flags and it completed successfully this time.

Cool.

Man, Windows anti-virus software is a real nuisance.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] Cannot find a working 64-bit integer type

2016-01-17 Thread Igal @ Lucee.org
UPDATE: when I ran: configure --without-zlib --enable-debug 
CFLAGS="-Wno-cpp"


I did not get an error from configure (though I get an error from "make" 
but that's another issue)


I'm not sure what I'm "losing" by passing the "no-cpp" compiler flag?

also, the thread I mentioned in the previous email can be found at 
http://postgresql.nabble.com/Setting-Werror-in-CFLAGS-td5118384.html


Igal Sapir
Lucee Core Developer
Lucee.org 

On 1/17/2016 12:07 PM, Igal @ Lucee.org wrote:

Hi,

I'm trying to build Postgres with GCC 5.3.0 on Windows (a-la MinGW-64) 
and when I ran "configure" I received the following error:

"configure: error: Cannot find a working 64-bit integer type."

The config.log file can be seen at
https://gist.github.com/TwentyOneSolutions/8c225f66b9c0d4434871#file-config-201601171200-log-L21971

A google search finds this thread from 4 years ago, the IIUC explains 
that the issue is with newer GCC versions.


Any ideas on how I can overcome this issue?

Thanks!

--

Igal Sapir
Lucee Core Developer
Lucee.org 





Re: [HACKERS] cannot set view triggers to replica

2015-05-30 Thread Michael Paquier
On Sat, May 30, 2015 at 11:47 AM, Peter Eisentraut pete...@gmx.net wrote:
 It appears to be an omission that ALTER TABLE ... ENABLE TRIGGER and
 similar commands don't allow acting on views, even though we now have
 triggers on views.

True, now isn't it something that should be as well part of ALTER VIEW?

 Similarly, the ALTER TABLE ... ENABLE RULE commands only allow acting on
 tables, even though rules can also exist on views and materialized views.

I think that ALTER VIEW and ALTER MATERIALIZED VIEW should be able to
accept the command as well.

 Attached is a sample patch.  It appears we don't have any regression
 tests for this.

This sounds like a mandatory condition for this patch.
-- 
Michael


-- 
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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Michael Paquier
On Mon, May 12, 2014 at 8:10 PM, Pavel Stehule pavel.steh...@gmail.com wrote:
 g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
 -I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2
 -fPIC -c -o plv8.o plv8.cc
 plv8.cc:50:56: error: declaration of 'Datum
 plv8_call_handler(FunctionCallInfo) throw ()' has a different exception
 specifier
  Datum plv8_call_handler(PG_FUNCTION_ARGS) throw();
 Some ideas how to fix it?
It seems that you are compiling on the outdated branch staticlink. On
either master or r1.4 it will work properly on Fedora 20, at least it
works for me.
-- 
Michael


-- 
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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Pavel Stehule
2014-05-12 13:45 GMT+02:00 Michael Paquier michael.paqu...@gmail.com:

 On Mon, May 12, 2014 at 8:10 PM, Pavel Stehule pavel.steh...@gmail.com
 wrote:
  g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
  -I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2
  -fPIC -c -o plv8.o plv8.cc
  plv8.cc:50:56: error: declaration of 'Datum
  plv8_call_handler(FunctionCallInfo) throw ()' has a different exception
  specifier
   Datum plv8_call_handler(PG_FUNCTION_ARGS) throw();
  Some ideas how to fix it?
 It seems that you are compiling on the outdated branch staticlink. On
 either master or r1.4 it will work properly on Fedora 20, at least it
 works for me.


How I can check it?

I had same bug with scientific linux and I expected so this problem will be
solved on new Fedora. On second computer on newer system I had same problem.

Some problem can be in my g++ environment - it is default Fedora.

Pavel


 --
 Michael



Re: [HACKERS] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Andrew Dunstan


On 05/12/2014 07:10 AM, Pavel Stehule wrote:

Hello

I am trying to compile PL/v8 without success. I have Postgres 
installed via compilation from source code.


After make I got errors

[pavel@localhost plv8-1.4.2]$ make
g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server 
-I/usr/local/pgsql/include/internal -D_GNU_SOURCE 
-I/usr/include/libxml2  -fPIC -c -o plv8.o plv8.cc
plv8.cc:50:56: error: declaration of ‘Datum 
plv8_call_handler(FunctionCallInfo) throw ()’ has a different 
exception specifier

 Datum plv8_call_handler(PG_FUNCTION_ARGS) throw();
^
plv8.cc:43:7: error: from previous declaration ‘Datum 
plv8_call_handler(FunctionCallInfo)’

 PG_FUNCTION_INFO_V1(plv8_call_handler);


This looks like a result of commit 
http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e7128e8dbb305059c30ec085461297e619bcbff4 
Maybe we need a way of telling the preprocessor to suppress the 
generation of a prototype?


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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Pavel Stehule
2014-05-12 15:42 GMT+02:00 Andrew Dunstan and...@dunslane.net:


 On 05/12/2014 07:10 AM, Pavel Stehule wrote:

 Hello

 I am trying to compile PL/v8 without success. I have Postgres installed
 via compilation from source code.

 After make I got errors

 [pavel@localhost plv8-1.4.2]$ make
 g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
 -I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2
  -fPIC -c -o plv8.o plv8.cc
 plv8.cc:50:56: error: declaration of ‘Datum 
 plv8_call_handler(FunctionCallInfo)
 throw ()’ has a different exception specifier
  Datum plv8_call_handler(PG_FUNCTION_ARGS) throw();
 ^
 plv8.cc:43:7: error: from previous declaration ‘Datum plv8_call_handler(
 FunctionCallInfo)’
  PG_FUNCTION_INFO_V1(plv8_call_handler);


 This looks like a result of commit http://git.postgresql.org/
 gitweb/?p=postgresql.git;a=commitdiff;h=e7128e8dbb305059c30ec085461297
 e619bcbff4 Maybe we need a way of telling the preprocessor to suppress
 the generation of a prototype?


I got same result with tarball 9.2.4 released 2014-04-04

Pavel



 cheers

 andrew




Re: [HACKERS] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Tom Lane
Andrew Dunstan and...@dunslane.net writes:
 On 05/12/2014 07:10 AM, Pavel Stehule wrote:
 I am trying to compile PL/v8 without success. I have Postgres 
 installed via compilation from source code.

 plv8.cc:50:56: error: declaration of ‘Datum 
 plv8_call_handler(FunctionCallInfo) throw ()’ has a different 
 exception specifier
 Datum plv8_call_handler(PG_FUNCTION_ARGS) throw();
 ^
 plv8.cc:43:7: error: from previous declaration ‘Datum 
 plv8_call_handler(FunctionCallInfo)’
 PG_FUNCTION_INFO_V1(plv8_call_handler);

 This looks like a result of commit 
 http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e7128e8dbb305059c30ec085461297e619bcbff4
  

Ouch.  I was a bit suspicious of that change from the start, but it hadn't
occurred to me that functions written in C++ would have an issue with it.

 Maybe we need a way of telling the preprocessor to suppress the 
 generation of a prototype?

Maybe we need to revert that patch altogether.  Dealing with this is
likely to introduce much more pain and confusion than the change is worth.

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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Pavel Stehule
2014-05-12 16:31 GMT+02:00 Tom Lane t...@sss.pgh.pa.us:

 Andrew Dunstan and...@dunslane.net writes:
  On 05/12/2014 07:10 AM, Pavel Stehule wrote:
  I am trying to compile PL/v8 without success. I have Postgres
  installed via compilation from source code.

  plv8.cc:50:56: error: declaration of ‘Datum
  plv8_call_handler(FunctionCallInfo) throw ()’ has a different
  exception specifier
  Datum plv8_call_handler(PG_FUNCTION_ARGS) throw();
  ^
  plv8.cc:43:7: error: from previous declaration ‘Datum
  plv8_call_handler(FunctionCallInfo)’
  PG_FUNCTION_INFO_V1(plv8_call_handler);

  This looks like a result of commit
  
 http://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e7128e8dbb305059c30ec085461297e619bcbff4
 

 Ouch.  I was a bit suspicious of that change from the start, but it hadn't
 occurred to me that functions written in C++ would have an issue with it.

  Maybe we need a way of telling the preprocessor to suppress the
  generation of a prototype?

 Maybe we need to revert that patch altogether.  Dealing with this is
 likely to introduce much more pain and confusion than the change is worth.


After returning back before this commit I cannot compile PL/V8 still but
with more solvable bug

 g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
-I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2
-fPIC -c -o plv8.o plv8.cc
g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
-I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2
-fPIC -c -o plv8_type.o plv8_type.cc
g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
-I/usr/local/pgsql/include/internal -D_GNU_SOURCE -I/usr/include/libxml2
-fPIC -c -o plv8_func.o plv8_func.cc
plv8_func.cc: In function ‘v8::Handlev8::Value plv8_Prepare(const
v8::Arguments)’:
plv8_func.cc:521:47: error: too few arguments to function ‘void
parseTypeString(const char*, Oid*, int32*, bool)’
   parseTypeString(typestr, types[i], typemod);
   ^
In file included from plv8_func.cc:22:0:
/usr/local/pgsql/include/server/parser/parse_type.h:50:13: note: declared
here
 extern void parseTypeString(const char *str, Oid *typeid_p, int32
*typmod_p, bool missing_ok);
 ^
make: *** [plv8_func.o] Error 1

so the main issue is really this commit

Regards

Pavel

p.s. my tests on 9.2 was messy probably






 regards, tom lane



Re: [HACKERS] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Peter Eisentraut
On 5/12/14, 11:05 AM, Pavel Stehule wrote:
 After returning back before this commit I cannot compile PL/V8 still but
 with more solvable bug
 
  g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
 -I/usr/local/pgsql/include/internal -D_GNU_SOURCE
 -I/usr/include/libxml2  -fPIC -c -o plv8.o plv8.cc
 g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
 -I/usr/local/pgsql/include/internal -D_GNU_SOURCE
 -I/usr/include/libxml2  -fPIC -c -o plv8_type.o plv8_type.cc
 g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
 -I/usr/local/pgsql/include/internal -D_GNU_SOURCE
 -I/usr/include/libxml2  -fPIC -c -o plv8_func.o plv8_func.cc
 plv8_func.cc: In function ‘v8::Handlev8::Value plv8_Prepare(const
 v8::Arguments)’:
 plv8_func.cc:521:47: error: too few arguments to function ‘void
 parseTypeString(const char*, Oid*, int32*, bool)’
parseTypeString(typestr, types[i], typemod);
^
 In file included from plv8_func.cc:22:0:
 /usr/local/pgsql/include/server/parser/parse_type.h:50:13: note:
 declared here
  extern void parseTypeString(const char *str, Oid *typeid_p, int32
 *typmod_p, bool missing_ok);
  ^
 make: *** [plv8_func.o] Error 1
 
 so the main issue is really this commit

You need plv8 master branch (unreleased), which fixes all these issues.
 No released version of plv8 works with 9.4 at the moment.


-- 
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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Pavel Stehule
2014-05-12 18:36 GMT+02:00 Peter Eisentraut pete...@gmx.net:

 On 5/12/14, 11:05 AM, Pavel Stehule wrote:
  After returning back before this commit I cannot compile PL/V8 still but
  with more solvable bug
 
   g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
  -I/usr/local/pgsql/include/internal -D_GNU_SOURCE
  -I/usr/include/libxml2  -fPIC -c -o plv8.o plv8.cc
  g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
  -I/usr/local/pgsql/include/internal -D_GNU_SOURCE
  -I/usr/include/libxml2  -fPIC -c -o plv8_type.o plv8_type.cc
  g++ -Wall -O2  -I. -I./ -I/usr/local/pgsql/include/server
  -I/usr/local/pgsql/include/internal -D_GNU_SOURCE
  -I/usr/include/libxml2  -fPIC -c -o plv8_func.o plv8_func.cc
  plv8_func.cc: In function ‘v8::Handlev8::Value plv8_Prepare(const
  v8::Arguments)’:
  plv8_func.cc:521:47: error: too few arguments to function ‘void
  parseTypeString(const char*, Oid*, int32*, bool)’
 parseTypeString(typestr, types[i], typemod);
 ^
  In file included from plv8_func.cc:22:0:
  /usr/local/pgsql/include/server/parser/parse_type.h:50:13: note:
  declared here
   extern void parseTypeString(const char *str, Oid *typeid_p, int32
  *typmod_p, bool missing_ok);
   ^
  make: *** [plv8_func.o] Error 1
 
  so the main issue is really this commit

 You need plv8 master branch (unreleased), which fixes all these issues.
  No released version of plv8 works with 9.4 at the moment.


ok, I'll check it

Thank you

Pavel


Re: [HACKERS] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes:
 You need plv8 master branch (unreleased), which fixes all these issues.

How does it deal with the function declaration incompatibility problem?

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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Peter Eisentraut
On 5/12/14, 12:42 PM, Tom Lane wrote:
 Peter Eisentraut pete...@gmx.net writes:
 You need plv8 master branch (unreleased), which fixes all these issues.
 
 How does it deal with the function declaration incompatibility problem?

commit df92ced297282ffbb13e95748543b6c52ad4d238
Author: Hitoshi Harada umi.tan...@gmail.com
Date:   Wed May 7 01:28:18 2014 -0700

Remove exception specifier from PG callbacks.

9.4 includes function declaration in PG_FUNCTION_INFO_V1 macro, which is
not compatible with ours using exception specifiers.  Actually I don't
see the reason we have them so simply I remove them.


That said, I'm not yet sure what the overall right answer is here.



-- 
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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Alvaro Herrera
Peter Eisentraut wrote:
 On 5/12/14, 12:42 PM, Tom Lane wrote:
  Peter Eisentraut pete...@gmx.net writes:
  You need plv8 master branch (unreleased), which fixes all these issues.
  
  How does it deal with the function declaration incompatibility problem?
 
 commit df92ced297282ffbb13e95748543b6c52ad4d238
 Author: Hitoshi Harada umi.tan...@gmail.com
 Date:   Wed May 7 01:28:18 2014 -0700
 
 Remove exception specifier from PG callbacks.
 
 9.4 includes function declaration in PG_FUNCTION_INFO_V1 macro, which is
 not compatible with ours using exception specifiers.  Actually I don't
 see the reason we have them so simply I remove them.

Do C++ exception specifiers in fmgr V1 functions work at all?

-- 
Álvaro Herrerahttp://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training  Services


-- 
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] cannot to compile PL/V8 on Fedora 20

2014-05-12 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes:
 On 5/12/14, 12:42 PM, Tom Lane wrote:
 Peter Eisentraut pete...@gmx.net writes:
 You need plv8 master branch (unreleased), which fixes all these issues.

 How does it deal with the function declaration incompatibility problem?

 commit df92ced297282ffbb13e95748543b6c52ad4d238
 Author: Hitoshi Harada umi.tan...@gmail.com
 Date:   Wed May 7 01:28:18 2014 -0700

 Remove exception specifier from PG callbacks.

 9.4 includes function declaration in PG_FUNCTION_INFO_V1 macro, which is
 not compatible with ours using exception specifiers.  Actually I don't
 see the reason we have them so simply I remove them.

 That said, I'm not yet sure what the overall right answer is here.

Hm.  If you're writing SQL functions in C++, you definitely don't want
them throwing any C++ exceptions out to the core backend; so the throw()
declaration is sensible and might help catch coding errors.  That means
that Hitoshi-san's solution is just a quick hack rather than a desirable
answer.

We could perhaps use an #ifdef __cplusplus in the declaration of
PG_FUNCTION_INFO_V1 to forcibly put a throw() into the extern when
compiling C++.  That would break less-carefully-written C++ code, but
the fix would be easy (unless they are throwing exceptions, but then
they've got a bug to fix anyway).

I'm concerned though that this may not be the only use-case for
decorations on those externs.  A slightly more flexible answer
is to make it look like

#ifdef __cplusplus
#define PG_FUNCTION_DECORATION throw()
#else
#define PG_FUNCTION_DECORATION
#endif

#define PG_FUNCTION_INFO_V1(funcname) \
Datum funcname(PG_FUNCTION_ARGS) PG_FUNCTION_DECORATION; \
extern ...

which would leave the door open for modules to redefine
PG_FUNCTION_DECORATION if they had to.  On the other hand it could
reasonably be argued that that would largely break the point of
having a uniform extern declaration in the first place.

Still wondering if we shouldn't just revert this change as being more
pain than gain.

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] Cannot allocate memory

2013-11-15 Thread Kevin Grittner
Heng Zhi Feng (zh...@hsr.ch) zh...@hsr.ch wrote:

 Virtual Machine – Ubuntu 13.10
 1.92GB Memory
 2 Parallel Processors

 work_mem = 11MB

 shared_buffers = 448MB
 max_connections = 80

 2013-11-15 11:02:35 CET LOG:  could not fork autovacuum worker process: 
 Cannot allocate memory
 2013-11-15 11:02:36 CET LOG:  could not send data to client: Broken pipe
 2013-11-15 11:02:36 CET LOG:  unexpected EOF on client connection

Before you start PostgreSQL, what does `free -m` show?

On such a tiny machine, some of the usual advice needs to be
modified a bit.  Sure, people say to start with shared_buffers at
25% of machine RAM, but if the (virtual) machine has so little RAM
that the OS is already taking a significant percentage, I would say
to go with 25% of what is free (excluding OS cache).  Likewise, the
advice I usually give to start with work_mem at 25% of machine RAM
divided by max_connections should be based on *available* RAM.  So
4MB to 5MB is probably going to be more appropriate than 11MB.  You
will probably need to reduce temp_buffers to 2MB or less -- right
now 1/3 of your machine RAM could be tied up in space reserved for
caching temporary table data, not released until connections close.

Since this VM is tight on resources and only has two cores, you
might want to use pgbouncer, configured in transaction mode with a
pool limited to something like 5 connections, so that you can
increase work_mem and avoid over-taxing the resources you have.

http://wiki.postgresql.org/wiki/Number_Of_Database_Connections

-- 
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] cannot move relocatable extension out of pg_catalog schema

2013-02-04 Thread Hannu Krosing

On 02/04/2013 02:16 AM, Robert Haas wrote:

On Fri, Feb 1, 2013 at 5:13 PM, Peter Eisentraut pete...@gmx.net wrote:

I wonder whether it'd not be a better idea to forbid specifying
pg_catalog as the target schema for relocatable extensions.

But that would be important, I think.

I understand the temptation to forbid pg_catalog as the target schema
for relocatable extensions, or indeed for object creation in general.
The fact that you can't, for example, go back and drop the objects
later is a real downer. On the other hand, from a user perspective,
it's really tempting to want to create certain extensions (adminpack,
for example) in such a way that they appear to be part of the system
rather than something that lives in a user schema.  Had we some other
solution to that problem (a second schema that behaves like pg_catalog
but is empty by default and allows drops?) we might alleviate the need
to put stuff in pg_catalog per se.

+1

Having a standard schema for extensions (say pg_extensions) is
something I have wanted multiple times.

Hannu





--
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] cannot move relocatable extension out of pg_catalog schema

2013-02-04 Thread Dimitri Fontaine
Robert Haas robertmh...@gmail.com writes:
 On Fri, Feb 1, 2013 at 5:13 PM, Peter Eisentraut pete...@gmx.net wrote:
 I wonder whether it'd not be a better idea to forbid specifying
 pg_catalog as the target schema for relocatable extensions.

We should do that, yes. Rationale: it's only documenting an existing
restriction that you just explained we can't get rid of. Want me to send
a patch (tomorrow)?

 I understand the temptation to forbid pg_catalog as the target schema
 for relocatable extensions, or indeed for object creation in general.

Those two cases are not to be mixed.

 The fact that you can't, for example, go back and drop the objects
 later is a real downer. On the other hand, from a user perspective,
 it's really tempting to want to create certain extensions (adminpack,
 for example) in such a way that they appear to be part of the system
 rather than something that lives in a user schema.  Had we some other

It's easy to do that in the extension's control properties:

relocatable = false
schema = pg_catalog

And the adminpack extension is already set that way. It's then part of
the system and you can still remove it. The only think you can not do is
move its objects in another schema, and I don't much see the point.

 solution to that problem (a second schema that behaves like pg_catalog
 but is empty by default and allows drops?) we might alleviate the need
 to put stuff in pg_catalog per se.

We had extensive talks about that when cooking the extension patch, and
that almost killed it. I think it took about a full year to get back on
our feet again. The only thing I know about that search_path can of
worms is that I will stay away from it as much as possible, and
wholeheartedly advice anyone to do the same.

Regards,
-- 
Dimitri Fontaine
http://2ndQuadrant.fr PostgreSQL : Expertise, Formation et 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] cannot move relocatable extension out of pg_catalog schema

2013-02-03 Thread Robert Haas
On Fri, Feb 1, 2013 at 5:13 PM, Peter Eisentraut pete...@gmx.net wrote:
 I wonder whether it'd not be a better idea to forbid specifying
 pg_catalog as the target schema for relocatable extensions.

 But that would be important, I think.

I understand the temptation to forbid pg_catalog as the target schema
for relocatable extensions, or indeed for object creation in general.
The fact that you can't, for example, go back and drop the objects
later is a real downer. On the other hand, from a user perspective,
it's really tempting to want to create certain extensions (adminpack,
for example) in such a way that they appear to be part of the system
rather than something that lives in a user schema.  Had we some other
solution to that problem (a second schema that behaves like pg_catalog
but is empty by default and allows drops?) we might alleviate the need
to put stuff in pg_catalog per se.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


-- 
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] cannot move relocatable extension out of pg_catalog schema

2013-02-01 Thread Tom Lane
Peter Eisentraut pete...@gmx.net writes:
 create extension hstore with schema pg_catalog;
 alter extension hstore set schema public;
 ERROR:  0A000: cannot remove dependency on schema pg_catalog because it
 is a system object
 drop extension hstore;  -- works

 I've seen this happen cleaning up after mistakenly misplaced extensions.
  I suspect this is a bug.

It's not a bug, it's an intentional implementation restriction that
would be quite expensive to remove.

The reason it fails is that we don't record dependencies on system
objects, and therefore there's no way for ALTER EXTENSION to modify
those dependencies when trying to do SET SCHEMA.  That is, since
pg_catalog is pinned, we don't have any explicit record of which
objects in the extension would've needed dependencies on it, thus
no way to manufacture the dependencies on schema public that would
need to exist after the SET SCHEMA.

AFAICS the only maintainable fix would be to start storing dependencies
on pinned objects explicitly, which would make for enormous and 99.99%
useless bloat in pg_depend.

I wonder whether it'd not be a better idea to forbid specifying
pg_catalog as the target schema for relocatable extensions.

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] cannot move relocatable extension out of pg_catalog schema

2013-02-01 Thread Peter Eisentraut
On 2/1/13 3:21 PM, Tom Lane wrote:
 Peter Eisentraut pete...@gmx.net writes:
 create extension hstore with schema pg_catalog;
 alter extension hstore set schema public;
 ERROR:  0A000: cannot remove dependency on schema pg_catalog because it
 is a system object
 drop extension hstore;  -- works
 
 I've seen this happen cleaning up after mistakenly misplaced extensions.
  I suspect this is a bug.
 
 It's not a bug, it's an intentional implementation restriction that
 would be quite expensive to remove.
 
 The reason it fails is that we don't record dependencies on system
 objects, and therefore there's no way for ALTER EXTENSION to modify
 those dependencies when trying to do SET SCHEMA.  That is, since
 pg_catalog is pinned, we don't have any explicit record of which
 objects in the extension would've needed dependencies on it, thus
 no way to manufacture the dependencies on schema public that would
 need to exist after the SET SCHEMA.

Fair enough.  It's not that important.

 I wonder whether it'd not be a better idea to forbid specifying
 pg_catalog as the target schema for relocatable extensions.

But that would be important, I think.



-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-05 Thread Robert Haas
On Sun, Dec 4, 2011 at 4:26 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 Tomas Vondra t...@fuzzy.cz writes:
 What about the pg_stat_activity - is it safe to access that from auth
 hook or is that just a coincidence that it works (and might stop working
 in the future)?

 It doesn't seem like a good thing to rely on.  There's certainly no
 testing being done that would cause us to notice if it stopped working
 so early in backend startup.

I'm still puzzled that Tomas got it working at all.  If MyDatabaseId
hasn't been set yet, the how did we manage to build a relcache entry
for anything - let alone an unshared catalog?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-05 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes:
 I'm still puzzled that Tomas got it working at all.  If MyDatabaseId
 hasn't been set yet, the how did we manage to build a relcache entry
 for anything - let alone an unshared catalog?

Well, he wasn't actually issuing a SQL query, just calling some of the
pgstat.c subroutines that underlie the view.  It happens that the pgstat
module has no backend-local initialization (at the moment, and
discounting the issue of making the process's own pgstat_activity entry),
so they were happy enough.  It was the syscache stuff that was spitting
up.

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] cannot read pg_class without having selected a database / is this a bug?

2011-12-05 Thread Robert Haas
On Mon, Dec 5, 2011 at 10:46 AM, Tom Lane t...@sss.pgh.pa.us wrote:
 Robert Haas robertmh...@gmail.com writes:
 I'm still puzzled that Tomas got it working at all.  If MyDatabaseId
 hasn't been set yet, the how did we manage to build a relcache entry
 for anything - let alone an unshared catalog?

 Well, he wasn't actually issuing a SQL query, just calling some of the
 pgstat.c subroutines that underlie the view.  It happens that the pgstat
 module has no backend-local initialization (at the moment, and
 discounting the issue of making the process's own pgstat_activity entry),
 so they were happy enough.  It was the syscache stuff that was spitting
 up.

Oh, I see.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-04 Thread Tomas Vondra
On 4.12.2011 05:19, Tom Lane wrote:
 Tomas Vondra t...@fuzzy.cz writes:
 That might explain why it fails at first and then works just fine,
 although it's a bit strange. Wouldn't that mean you can't access any
 catalogs from the auth hook?
 
 It should be possible to access shared catalogs from an auth hook.
 pg_stat_activity is neither shared nor a catalog.  Like Robert,
 I find it astonishing that this works ever, because the info needed
 simply isn't available until you've connected to a particular database.
 The fact that the view is actually defined the same in every database
 doesn't enter into that ...

Hmmm, I do admit this is the first time I play with these things
(relcache, catalogs ...) so closely. so there are obviously things I'm
not aware of. For example I'm a bit confused what is / is not a shared
catalogue. Thanks in advance for your patience.

Anyway, the code I posted does not fail because of pg_stat_activity, it
fails because it attempts for find the dbname/username for the backends
(read from pg_stat_activity).

I've removed pg_stat_activity (see the code below) and it still fails.
The reason is that get_database_name attempts to read pg_database, but
once it gets to ScanPgRelation in relcache.c it notices MyDatabaseID=0
and so the check fails

This is the simplified code:

if (status == STATUS_OK)
{
char * db;

LWLockAcquire(lock, LW_EXCLUSIVE);

sleep(1);

if (MyBackendId  2) {
db = get_database_name(17000);
}

sleep(4);

LWLockRelease(lock);

}

If you start two backends at the same time, the first one gets ID=2 and
skips the get_database_name call, the second one gets ID=3 and calls the
function (and it fails). Subsequent calls work, because the first
backend initializes the relcache or something.

Tomas

-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-04 Thread Tom Lane
Tomas Vondra t...@fuzzy.cz writes:
 On 4.12.2011 05:19, Tom Lane wrote:
 It should be possible to access shared catalogs from an auth hook.
 pg_stat_activity is neither shared nor a catalog.  Like Robert,
 I find it astonishing that this works ever, because the info needed
 simply isn't available until you've connected to a particular database.
 The fact that the view is actually defined the same in every database
 doesn't enter into that ...

 Hmmm, I do admit this is the first time I play with these things
 (relcache, catalogs ...) so closely. so there are obviously things I'm
 not aware of. For example I'm a bit confused what is / is not a shared
 catalogue. Thanks in advance for your patience.

See pg_class.relisshared.

 Anyway, the code I posted does not fail because of pg_stat_activity, it
 fails because it attempts for find the dbname/username for the backends
 (read from pg_stat_activity).

Well, get_database_name tries to do a syscache lookup, and the syscache
infrastructure isn't working yet.  It is possible to read a shared
catalog at this stage, but you have to use lower-level access mechanisms
--- for an example with some comments, look at GetDatabaseTuple in
postinit.c.

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] cannot read pg_class without having selected a database / is this a bug?

2011-12-04 Thread Tomas Vondra
On 4.12.2011 17:10, Tom Lane wrote:
 Tomas Vondra t...@fuzzy.cz writes:
 Anyway, the code I posted does not fail because of pg_stat_activity, it
 fails because it attempts for find the dbname/username for the backends
 (read from pg_stat_activity).
 
 Well, get_database_name tries to do a syscache lookup, and the syscache
 infrastructure isn't working yet.  It is possible to read a shared
 catalog at this stage, but you have to use lower-level access mechanisms
 --- for an example with some comments, look at GetDatabaseTuple in
 postinit.c.

Great, this seems to work perfectly.

What about the pg_stat_activity - is it safe to access that from auth
hook or is that just a coincidence that it works (and might stop working
in the future)?

Tomas

-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-04 Thread Tom Lane
Tomas Vondra t...@fuzzy.cz writes:
 What about the pg_stat_activity - is it safe to access that from auth
 hook or is that just a coincidence that it works (and might stop working
 in the future)?

It doesn't seem like a good thing to rely on.  There's certainly no
testing being done that would cause us to notice if it stopped working
so early in backend startup.

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] cannot read pg_class without having selected a database / is this a bug?

2011-12-03 Thread Robert Haas
2011/12/3 Tomas Vondra t...@fuzzy.cz:
 psql: FATAL:  cannot read pg_class without having selected a database

 I've found this happens because the extension defines a client auth hook
 that reads pg_stat_activity. The really interesting thing is that this
 happens only when I start several backends 'at the same time' right
 after the cluster is started. From that time, everything works just fine.

I'm surprised this ever works.  To read pg_stat_activity, you need a
relcache entry for it.  And how will you build one without selecting a
database?

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-03 Thread Tomas Vondra
On 3.12.2011 23:37, Robert Haas wrote:
 2011/12/3 Tomas Vondra t...@fuzzy.cz:
 psql: FATAL:  cannot read pg_class without having selected a database

 I've found this happens because the extension defines a client auth hook
 that reads pg_stat_activity. The really interesting thing is that this
 happens only when I start several backends 'at the same time' right
 after the cluster is started. From that time, everything works just fine.
 
 I'm surprised this ever works.  To read pg_stat_activity, you need a
 relcache entry for it.  And how will you build one without selecting a
 database?

What do you mean by selecting a database?

I do select a database when executing a psql, but I guess you mean
something that initializes the relcache entry and that's probably
executed after the auth hook.

That might explain why it fails at first and then works just fine,
although it's a bit strange. Wouldn't that mean you can't access any
catalogs from the auth hook?

Tomas

-- 
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] cannot read pg_class without having selected a database / is this a bug?

2011-12-03 Thread Tom Lane
Tomas Vondra t...@fuzzy.cz writes:
 That might explain why it fails at first and then works just fine,
 although it's a bit strange. Wouldn't that mean you can't access any
 catalogs from the auth hook?

It should be possible to access shared catalogs from an auth hook.
pg_stat_activity is neither shared nor a catalog.  Like Robert,
I find it astonishing that this works ever, because the info needed
simply isn't available until you've connected to a particular database.
The fact that the view is actually defined the same in every database
doesn't enter into that ...

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] Cannot

2011-10-26 Thread Andrew Dunstan



On 10/26/2011 02:16 PM, David E. Wheeler wrote:

Suggested doc “patch”:

 grep -lri 'can not' doc | xargs perl -i -pe 's/can not/cannot/g'




Why? can not is perfectly grammatical AFAIK.

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] Cannot

2011-10-26 Thread David E. Wheeler
On Oct 26, 2011, at 2:06 PM, Andrew Dunstan wrote:

 Suggested doc “patch”:
 
 grep -lri 'can not' doc | xargs perl -i -pe 's/can not/cannot/g'
 
 Why? can not is perfectly grammatical AFAIK.

True, but there's a logic issue. Take this example from doc/src/sgml/func.sgml:

para
  functionpg_advisory_xact_lock/ works the same as
  functionpg_advisory_lock/, expect the lock is automatically released
  at the end of the current transaction and can not be released explicitly.
 /para

I read this as equivalent to can be not released. Which of course is silly, 
so as I read it I realize what it means, but it trips up my overly logical 
brain. It interrupts the flow. There is no such confusion in cannot be 
released and thus no tripping up on meaning.

Best,

David
-- 
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] Cannot

2011-10-26 Thread Andrew Dunstan



On 10/26/2011 05:15 PM, David E. Wheeler wrote:

On Oct 26, 2011, at 2:06 PM, Andrew Dunstan wrote:


Suggested doc “patch”:

 grep -lri 'can not' doc | xargs perl -i -pe 's/can not/cannot/g'

Why? can not is perfectly grammatical AFAIK.

True, but there's a logic issue. Take this example from doc/src/sgml/func.sgml:


para
  functionpg_advisory_xact_lock/  works the same as
  functionpg_advisory_lock/, expect the lock is automatically released
  at the end of the current transaction and can not be released explicitly.
 /para

I read this as equivalent to can be not released. Which of course is silly, so as I 
read it I realize what it means, but it trips up my overly logical brain. It interrupts the flow. 
There is no such confusion in cannot be released and thus no tripping up on meaning.




Here's what I would do:

1. s/expect/except that/

2. s/can not be released explicitly/can not be explicitly released/

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] Cannot

2011-10-26 Thread Tom Lane
David E. Wheeler da...@kineticode.com writes:
 On Oct 26, 2011, at 2:06 PM, Andrew Dunstan wrote:
 Why? can not is perfectly grammatical AFAIK.

 True, but there's a logic issue. Take this example from 
 doc/src/sgml/func.sgml:

 para
 functionpg_advisory_xact_lock/ works the same as
 functionpg_advisory_lock/, expect the lock is automatically released
 at the end of the current transaction and can not be released explicitly.
 /para

 I read this as equivalent to can be not released. Which of course is silly, 
 so as I read it I realize what it means, but it trips up my overly logical 
 brain. It interrupts the flow. There is no such confusion in cannot be 
 released and thus no tripping up on meaning.

This particular change seems like an improvement to me, but it's hardly
an adequate argument for a global search-and-replace.  There might be
other places where such a change renders things *less* readable.

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] Cannot

2011-10-26 Thread David E. Wheeler
On Oct 26, 2011, at 2:58 PM, Tom Lane wrote:

 I read this as equivalent to can be not released. Which of course is 
 silly, so as I read it I realize what it means, but it trips up my overly 
 logical brain. It interrupts the flow. There is no such confusion in cannot 
 be released and thus no tripping up on meaning.
 
 This particular change seems like an improvement to me, but it's hardly
 an adequate argument for a global search-and-replace.  There might be
 other places where such a change renders things *less* readable.

The patch is actually quite modest; there are only a few instances of can 
not. Attached.

Best,

David



cannot.patch
Description: Binary data

-- 
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] Cannot build docs of 9.1 on Windows

2011-05-24 Thread Andrew Dunstan



On 05/19/2011 06:29 PM, MauMau wrote:

From: Andrew Dunstan and...@dunslane.net

On Thu, May 19, 2011 10:32 am, Robert Haas wrote:

2011/5/16 MauMau maumau...@gmail.com:

Can't open perl script make-errcodes-table.pl: No such file or
directory


I think this is the root of the problem.  We have no script called
make-errcodes-table.pl.  Can you try changing it to
generate-errcodes-table.pl and see if that works?




Building docs under Windows in the buildfarm is on my TODO list. We
already support it (as of a few weeks ago) for non-Windows build 
systems.


That will help us make sure we don't have this kind of drift.


Thank you. I could remove the error Can't open perl script 
make-errcodes-table.pl: N... by changing make-errcodes-table.pl 
to generate-errcodes-table.pl, but all other results seems to be 
same as before.


Andrew, could you announce the commit when you have successfully built 
docs on Windows? Can I know that fact by watching pgsql-hackers and 
pgsql-docs? I'll git-fetch the patch.





builddoc.bat failed on my system and reading it made my head hurt. So I 
did what I've done with other bat files and rewrote it in Perl. The 
result is attached. It works for me, and should be a dropin replacement. 
Just put it in the src/tools/msvc directory and run perl builddoc.pl. 
Please test it and if it works for you we'll use it and make 
builddoc.bat a thin wrapper like build.bat and vcregress.bat.


cheers

andrew


builddoc.pl
Description: Perl program

-- 
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] Cannot build docs of 9.1 on Windows

2011-05-24 Thread MauMau

Andrew,

From: Andrew Dunstan and...@dunslane.net

builddoc.bat failed on my system and reading it made my head hurt. So I
did what I've done with other bat files and rewrote it in Perl. The
result is attached. It works for me, and should be a dropin replacement.
Just put it in the src/tools/msvc directory and run perl builddoc.pl.
Please test it and if it works for you we'll use it and make
builddoc.bat a thin wrapper like build.bat and vcregress.bat.


It worked successfully! doc\src\sgml\html directory and its contents was 
created, and the HTML contents appear to be correct. Thank you very much. 
The output of perl builddoc.pl was as follows:



--
perl mk_feature_tables.pl YES 
../../../src/backend/catalog/sql_feature_packages.txt 
../../../src/backend/catalog/sql_features.txt  features-supported.sgmlperl 
mk_feature_tables.pl NO 
../../../src/backend/catalog/sql_feature_packages.txt 
../../../src/backend/catalog/sql_features.txt  features-unsupported.sgml
perl generate-errcodes-table.pl ../../../src/backend/utils/errcodes.txt  
errcodes-table.sgml

Running first build...
D:\pgdev\doctool/openjade-1.3.1/bin/openjade -V 
html-index -wall -wno-unused-param -wno-empty -D . -c 
D:\pgdev\doctool/docbook-dsssl-1.79/catalog -d stylesheet.dsl -i 
output-html -t sgml postgres.sgml 21 | findstr /V DTDDECL catalog entries 
are not supported

Running collateindex...
perl D:\pgdev\doctool/docbook-dsssl-1.79/bin/collateindex.pl -f -g -i 
bookindex -o bookindex.sgml HTML.index

Processing HTML.index...
2158 entries loaded...
0 entries ignored...
Done.
Running second build...
D:\pgdev\doctool/openjade-1.3.1/bin/openjade -wall -wno-unused-param -wno-empty 
-D . -c D:\pgdev\doctool/docbook-dsssl-1.79/catalog -d stylesheet.dsl -t 
sgml -i output-html -i include-index postgres.sgml 21 | findstr /V 
DTDDECL catalog entries are not supported

Docs build complete.
--


--
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] Cannot build docs of 9.1 on Windows

2011-05-19 Thread Andrew Dunstan
On Thu, May 19, 2011 10:32 am, Robert Haas wrote:
 2011/5/16 MauMau maumau...@gmail.com:
 Can't open perl script make-errcodes-table.pl: No such file or
 directory

 I think this is the root of the problem.  We have no script called
 make-errcodes-table.pl.  Can you try changing it to
 generate-errcodes-table.pl and see if that works?



Building docs under Windows in the buildfarm is on my TODO list. We
already support it (as of a few weeks ago) for non-Windows build systems.

That will help us make sure we don't have this kind of drift.

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] Cannot build docs of 9.1 on Windows

2011-05-19 Thread MauMau

From: Andrew Dunstan and...@dunslane.net

On Thu, May 19, 2011 10:32 am, Robert Haas wrote:

2011/5/16 MauMau maumau...@gmail.com:

Can't open perl script make-errcodes-table.pl: No such file or
directory


I think this is the root of the problem.  We have no script called
make-errcodes-table.pl.  Can you try changing it to
generate-errcodes-table.pl and see if that works?




Building docs under Windows in the buildfarm is on my TODO list. We
already support it (as of a few weeks ago) for non-Windows build systems.

That will help us make sure we don't have this kind of drift.


Thank you. I could remove the error Can't open perl script 
make-errcodes-table.pl: N... by changing make-errcodes-table.pl to 
generate-errcodes-table.pl, but all other results seems to be same as 
before.


Andrew, could you announce the commit when you have successfully built docs 
on Windows? Can I know that fact by watching pgsql-hackers and pgsql-docs? 
I'll git-fetch the patch.


Regards
MauMau


--
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] Cannot *start* server because of a typo in pg_hba.conf

2011-02-20 Thread Tom Lane
Devrim =?ISO-8859-1?Q?G=DCND=DCZ?= dev...@gunduz.org writes:
 Yesterday I spent about half an hour to dig an issue on my laptop -- 9.0
 instance did not start, and there were nothing in the logs. Eventually I
 straced postmaster on start, and noticed an extra char in the
 pg_hba.conf, which caused postmaster not to start.

 Is it possible to drop something to (startup) log file and mention about
 the syntax error in hba file?

That information would certainly be logged somewhere.  Maybe you looked
in the wrong log file?  Or you're using one of those configurations
where early output to stderr goes to /dev/null?

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] Cannot *start* server because of a typo in pg_hba.conf

2011-02-20 Thread Devrim GÜNDÜZ
On Sun, 2011-02-20 at 10:39 -0500, Tom Lane wrote:
 
  Is it possible to drop something to (startup) log file and mention
  about the syntax error in hba file?
 
 That information would certainly be logged somewhere.  Maybe you
 looked in the wrong log file?  Or you're using one of those
 configurations where early output to stderr goes to /dev/null? 

I tried to start postmaster with:

* pg_ctl -D data start
* postmaster -D data
* pg_ctl -D data -l logfile start

None of them logged anything to anywhere. You can reproduce it on your
machine, too.
-- 
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz


signature.asc
Description: This is a digitally signed message part


Re: [HACKERS] Cannot *start* server because of a typo in pg_hba.conf

2011-02-20 Thread Tom Lane
Devrim =?ISO-8859-1?Q?G=DCND=DCZ?= dev...@gunduz.org writes:
 On Sun, 2011-02-20 at 10:39 -0500, Tom Lane wrote:
 That information would certainly be logged somewhere.  Maybe you
 looked in the wrong log file?  Or you're using one of those
 configurations where early output to stderr goes to /dev/null? 

 None of them logged anything to anywhere. You can reproduce it on your
 machine, too.

No, I can't.  I get something like this on stderr:

LOG:  invalid connection type zlocal
CONTEXT:  line 82 of configuration file 
/home/postgres/testversion/data/pg_hba.conf
FATAL:  could not load pg_hba.conf

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] Cannot *start* server because of a typo in pg_hba.conf

2011-02-20 Thread Devrim GÜNDÜZ
On Sun, 2011-02-20 at 12:45 -0500, Tom Lane wrote:
 
  None of them logged anything to anywhere. You can reproduce it on
 your
  machine, too.
 
 No, I can't.  I get something like this on stderr:
 
 LOG:  invalid connection type zlocal 

Err, please try putting an extra char before the first comment line,
like:

w# PostgreSQL Client Authentication Configuration File

-- 
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Community: devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
http://www.gunduz.org  Twitter: http://twitter.com/devrimgunduz


signature.asc
Description: This is a digitally signed message part


Re: [HACKERS] Cannot *start* server because of a typo in pg_hba.conf

2011-02-20 Thread Thom Brown
2011/2/20 Devrim GÜNDÜZ dev...@gunduz.org:
 On Sun, 2011-02-20 at 12:45 -0500, Tom Lane wrote:

  None of them logged anything to anywhere. You can reproduce it on
 your
  machine, too.

 No, I can't.  I get something like this on stderr:

 LOG:  invalid connection type zlocal

 Err, please try putting an extra char before the first comment line,
 like:

 w# PostgreSQL Client Authentication Configuration File

That mistake looks familiar ;)

-- 
Thom Brown
Twitter: @darkixion
IRC (freenode): dark_ixion
Registered Linux user: #516935

-- 
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] Cannot *start* server because of a typo in pg_hba.conf

2011-02-20 Thread Tom Lane
Devrim =?ISO-8859-1?Q?G=DCND=DCZ?= dev...@gunduz.org writes:
 On Sun, 2011-02-20 at 12:45 -0500, Tom Lane wrote:
 No, I can't.  I get something like this on stderr:
 
 LOG:  invalid connection type zlocal 

 Err, please try putting an extra char before the first comment line,
 like:

 w# PostgreSQL Client Authentication Configuration File

Given exactly that mistake, I get

LOG:  invalid connection type w
CONTEXT:  line 1 of configuration file 
/home/postgres/testversion/data/pg_hba.conf
FATAL:  could not load pg_hba.conf

Are you sure you're looking in the right place?

One thought that comes to mind is that I've seen cases where SELinux
prevented the postmaster from writing anything at all to its stderr.
I didn't think that could still happen in any current SELinux versions,
but it might be worth checking the kernel log for avc denials.

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] Cannot compile Pg 9.0.2 with MinGW under Windows

2010-12-24 Thread Pavel Golub
Thanks, Andrew. I'll check my environment one more time.


You wrote:



AD On 12/23/2010 07:11 AM, Pavel Golub wrote:
 Hello, Pgsql-bugs.

 Tried to use MinGw under windows to build client libraries at least.
 However failed on ./configure --withou-zlib stage.

 Please find attached log file, stdout and stderr outputs.

 The main problem here I suppose is
 configure: WARNING:someheader.h: present but cannot be compiled

 Please five me advice on this.
 Thanks in advance


AD Your gcc doesn't look like others we have:

AD You have:

AD gcc (GCC) 3.4.4 (msys special)
AD Copyright (C) 2004 Free Software Foundation, Inc.
AD This is free software; see the source for copying conditions. There
AD is NO
AD warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
AD PURPOSE.

AD configure:3252: $? = 0
AD configure:3259: gcc -v 5
AD Reading specs from /usr/lib/gcc/i686-pc-msys/3.4.4/specs
AD Configured with: /home/cstrauss/build/gcc3/gcc-3.4.4/configure
AD --prefix=/usr --sysconfdir=/etc --localstatedir=/var
AD --infodir=/share/info --mandir=/share/man --libexecdir=/lib
AD --enable-languages=c,c++ --disable-nls --enable-threads=posix
AD --enable-sjlj-exceptions --enable-hash-synchronization
AD --enable-libstdcxx-debug --with-newlib
AD Thread model: posix



AD Buildfarm narwhal has:

AD gcc.exe (GCC) 3.4.2 (mingw-special)
AD Copyright (C) 2004 Free Software Foundation, Inc.
AD This is free software; see the source for copying conditions. There is 
NO
AD warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

AD configure:3252: $? = 0
AD configure:3259: gcc -v5
AD Reading specs from c:/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs
AD Configured with: ../gcc/configure --with-gcc --with-gnu-ld
AD --with-gnu-as --host=mingw32 --target=mingw32 --prefix=/mingw
AD --enable-threads --disable-nls
AD --enable-languages=c,c++,f77,ada,objc,java
AD --disable-win32-registry --disable-shared --enable-sjlj-exceptions
AD --enable-libgcj --disable-java-awt --without-x
AD --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter
AD --enable-hash-synchronization --enable-libstdcxx-debug
AD Thread model: win32
AD gcc version 3.4.2 (mingw-special)





AD Buildfarm frogmouth has:

AD gcc.exe (GCC) 4.5.0
AD Copyright (C) 2010 Free Software Foundation, Inc.
AD This is free software; see the source for copying conditions. There is 
NO
AD warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR 
PURPOSE.

AD configure:3252: $? = 0
AD configure:3259: gcc -v5
AD Using built-in specs.
AD COLLECT_GCC=c:\mingw\bin\gcc.exe
AD
AD 
COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe
AD Target: mingw32
AD Configured with: ../gcc-4.5.0/configure
AD --enable-languages=c,c++,ada,fortran,objc,obj-c++
AD --disable-sjlj-exceptions --with-dwarf2 --enable-shared
AD --enable-libgomp --disable-win32-registry --enable-libstdcxx-debug
AD --enable-version-specific-runtime-libs --disable-werror --build=mingw32 
--prefix=/mingw
AD Thread model: win32


AD gcc version 4.5.0 (GCC)




AD cheers

AD andrew



-- 
With best wishes,
 Pavel  mailto:pa...@gf.microolap.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] Cannot compile Pg 9.0.2 with MinGW under Windows

2010-12-23 Thread Andrew Dunstan



On 12/23/2010 07:11 AM, Pavel Golub wrote:

Hello, Pgsql-bugs.

Tried to use MinGw under windows to build client libraries at least.
However failed on ./configure --withou-zlib stage.

Please find attached log file, stdout and stderr outputs.

The main problem here I suppose is
configure: WARNING:someheader.h: present but cannot be compiled

Please five me advice on this.
Thanks in advance



Your gcc doesn't look like others we have:

You have:

   gcc (GCC) 3.4.4 (msys special)
   Copyright (C) 2004 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There
   is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
   PURPOSE.

   configure:3252: $? = 0
   configure:3259: gcc -v 5
   Reading specs from /usr/lib/gcc/i686-pc-msys/3.4.4/specs
   Configured with: /home/cstrauss/build/gcc3/gcc-3.4.4/configure
   --prefix=/usr --sysconfdir=/etc --localstatedir=/var
   --infodir=/share/info --mandir=/share/man --libexecdir=/lib
   --enable-languages=c,c++ --disable-nls --enable-threads=posix
   --enable-sjlj-exceptions --enable-hash-synchronization
   --enable-libstdcxx-debug --with-newlib
   Thread model: posix



Buildfarm narwhal has:

   gcc.exe (GCC) 3.4.2 (mingw-special)
   Copyright (C) 2004 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

   configure:3252: $? = 0
   configure:3259: gcc -v5
   Reading specs from c:/MinGW/bin/../lib/gcc/mingw32/3.4.2/specs
   Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as 
--host=mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls 
--enable-languages=c,c++,f77,ada,objc,java --disable-win32-registry 
--disable-shared --enable-sjlj-exceptions --enable-libgcj --disable-java-awt 
--without-x --enable-java-gc=boehm --disable-libgcj-debug --enable-interpreter 
--enable-hash-synchronization --enable-libstdcxx-debug
   Thread model: win32
   gcc version 3.4.2 (mingw-special)





Buildfarm frogmouth has:

   gcc.exe (GCC) 4.5.0
   Copyright (C) 2010 Free Software Foundation, Inc.
   This is free software; see the source for copying conditions.  There is NO
   warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

   configure:3252: $? = 0
   configure:3259: gcc -v5
   Using built-in specs.
   COLLECT_GCC=c:\mingw\bin\gcc.exe
   COLLECT_LTO_WRAPPER=c:/mingw/bin/../libexec/gcc/mingw32/4.5.0/lto-wrapper.exe
   Target: mingw32
   Configured with: ../gcc-4.5.0/configure 
--enable-languages=c,c++,ada,fortran,objc,obj-c++ --disable-sjlj-exceptions 
--with-dwarf2 --enable-shared --enable-libgomp --disable-win32-registry 
--enable-libstdcxx-debug --enable-version-specific-runtime-libs 
--disable-werror --build=mingw32 --prefix=/mingw
   Thread model: win32


   gcc version 4.5.0 (GCC)




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] Cannot cancel the change of a tablespace

2010-07-01 Thread Guillaume Lelarge
Le 30/06/2010 06:53, Guillaume Lelarge a écrit :
 Le 30/06/2010 05:25, Tom Lane a écrit :
 Robert Haas robertmh...@gmail.com writes:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 I tend to think we should fix it for 9.0, but could be talked out of
 it if someone has a compelling argument to make.

 Er, maybe I lost count, but I thought you were the one objecting to
 the patch.

 
 You're right. Robert questioned the use of CHECK_FOR_INTERRUPTS() in
 code available in the src/port directory. I don't see what issue could
 result with this. He also said that whatever would be commited should be
 back-patched.
 
 I can still add it for the next commit fest, I just don't want this
 patch to get lost. Though I won't be able to do this before getting back
 from work.
 

Finally, I added it to the next commit fest. Robert can work on it
before if he wants to (or has the time).

https://commitfest.postgresql.org/action/patch_view?id=331


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.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] Cannot cancel the change of a tablespace

2010-07-01 Thread Robert Haas
On Thu, Jul 1, 2010 at 5:30 AM, Guillaume Lelarge
guilla...@lelarge.info wrote:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 Finally, I added it to the next commit fest. Robert can work on it
 before if he wants to (or has the time).

I'd been avoiding working on this because Simon had said he was going
to commit it, but I can pick it up.  I've committed and back-patched
(to 8.0, as 7.4 does not have tablespaces) the fix for ALTER TABLE ..
SET TABLESPACE.  I'll take a look at the rest of it as well.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
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] Cannot cancel the change of a tablespace

2010-07-01 Thread Robert Haas
On Thu, Jul 1, 2010 at 10:18 AM, Robert Haas robertmh...@gmail.com wrote:
 On Thu, Jul 1, 2010 at 5:30 AM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 Finally, I added it to the next commit fest. Robert can work on it
 before if he wants to (or has the time).

 I'd been avoiding working on this because Simon had said he was going
 to commit it, but I can pick it up.  I've committed and back-patched
 (to 8.0, as 7.4 does not have tablespaces) the fix for ALTER TABLE ..
 SET TABLESPACE.  I'll take a look at the rest of it as well.

It looks like we have two reasonable choices here:

- We could backpatch this only to 8.4, where ALTER DATABASE .. SET
TABLESPACE was introduced.

- Or, since this also makes it easier to interrupt CREATE DATABASE new
TEMPLATE = some_big_database, we could back-patch it all the way to
8.1, which is the first release where we use copydir() rather than
invoking cp -r (except on Windows, where copydir() has always been
used, but releases  8.2 aren't supported on Windows anyway).

Since I can't remember anyone complaining about difficulty
interrupting CREATE DATABASE, I'm inclined to go back only to 8.4, and
will do that a bit later.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
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] Cannot cancel the change of a tablespace

2010-07-01 Thread Guillaume Lelarge
Le 01/07/2010 17:54, Robert Haas a écrit :
 On Thu, Jul 1, 2010 at 10:18 AM, Robert Haas robertmh...@gmail.com wrote:
 On Thu, Jul 1, 2010 at 5:30 AM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 Finally, I added it to the next commit fest. Robert can work on it
 before if he wants to (or has the time).

 I'd been avoiding working on this because Simon had said he was going
 to commit it, but I can pick it up.  I've committed and back-patched
 (to 8.0, as 7.4 does not have tablespaces) the fix for ALTER TABLE ..
 SET TABLESPACE.  I'll take a look at the rest of it as well.
 
 It looks like we have two reasonable choices here:
 
 - We could backpatch this only to 8.4, where ALTER DATABASE .. SET
 TABLESPACE was introduced.
 
 - Or, since this also makes it easier to interrupt CREATE DATABASE new
 TEMPLATE = some_big_database, we could back-patch it all the way to
 8.1, which is the first release where we use copydir() rather than
 invoking cp -r (except on Windows, where copydir() has always been
 used, but releases  8.2 aren't supported on Windows anyway).
 
 Since I can't remember anyone complaining about difficulty
 interrupting CREATE DATABASE, I'm inclined to go back only to 8.4, and
 will do that a bit later.
 

I agree that a backpatch to 8.4 seems enough.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.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] Cannot cancel the change of a tablespace

2010-07-01 Thread Robert Haas
On Thu, Jul 1, 2010 at 12:11 PM, Guillaume Lelarge
guilla...@lelarge.info wrote:
 Le 01/07/2010 17:54, Robert Haas a écrit :
 On Thu, Jul 1, 2010 at 10:18 AM, Robert Haas robertmh...@gmail.com wrote:
 On Thu, Jul 1, 2010 at 5:30 AM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 Finally, I added it to the next commit fest. Robert can work on it
 before if he wants to (or has the time).

 I'd been avoiding working on this because Simon had said he was going
 to commit it, but I can pick it up.  I've committed and back-patched
 (to 8.0, as 7.4 does not have tablespaces) the fix for ALTER TABLE ..
 SET TABLESPACE.  I'll take a look at the rest of it as well.

 It looks like we have two reasonable choices here:

 - We could backpatch this only to 8.4, where ALTER DATABASE .. SET
 TABLESPACE was introduced.

 - Or, since this also makes it easier to interrupt CREATE DATABASE new
 TEMPLATE = some_big_database, we could back-patch it all the way to
 8.1, which is the first release where we use copydir() rather than
 invoking cp -r (except on Windows, where copydir() has always been
 used, but releases  8.2 aren't supported on Windows anyway).

 Since I can't remember anyone complaining about difficulty
 interrupting CREATE DATABASE, I'm inclined to go back only to 8.4, and
 will do that a bit later.


 I agree that a backpatch to 8.4 seems enough.

Done.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
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] Cannot cancel the change of a tablespace

2010-07-01 Thread Guillaume Lelarge
Le 01/07/2010 22:13, Robert Haas a écrit :
 On Thu, Jul 1, 2010 at 12:11 PM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 Le 01/07/2010 17:54, Robert Haas a écrit :
 On Thu, Jul 1, 2010 at 10:18 AM, Robert Haas robertmh...@gmail.com wrote:
 On Thu, Jul 1, 2010 at 5:30 AM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us 
 wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 Finally, I added it to the next commit fest. Robert can work on it
 before if he wants to (or has the time).

 I'd been avoiding working on this because Simon had said he was going
 to commit it, but I can pick it up.  I've committed and back-patched
 (to 8.0, as 7.4 does not have tablespaces) the fix for ALTER TABLE ..
 SET TABLESPACE.  I'll take a look at the rest of it as well.

 It looks like we have two reasonable choices here:

 - We could backpatch this only to 8.4, where ALTER DATABASE .. SET
 TABLESPACE was introduced.

 - Or, since this also makes it easier to interrupt CREATE DATABASE new
 TEMPLATE = some_big_database, we could back-patch it all the way to
 8.1, which is the first release where we use copydir() rather than
 invoking cp -r (except on Windows, where copydir() has always been
 used, but releases  8.2 aren't supported on Windows anyway).

 Since I can't remember anyone complaining about difficulty
 interrupting CREATE DATABASE, I'm inclined to go back only to 8.4, and
 will do that a bit later.


 I agree that a backpatch to 8.4 seems enough.
 
 Done.
 

Thanks, Robert.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.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] Cannot cancel the change of a tablespace

2010-06-30 Thread Robert Haas
On Tue, Jun 29, 2010 at 11:25 PM, Tom Lane t...@sss.pgh.pa.us wrote:
 Robert Haas robertmh...@gmail.com writes:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 I tend to think we should fix it for 9.0, but could be talked out of
 it if someone has a compelling argument to make.

 Er, maybe I lost count, but I thought you were the one objecting to
 the patch.

No, I just wasn't sure whether it was safe.  If it's safe, I'm 100% in
favor of applying it and back-patching.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
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] Cannot cancel the change of a tablespace

2010-06-29 Thread Guillaume Lelarge
Le 23/06/2010 23:29, Guillaume Lelarge a écrit :
 Le 23/06/2010 22:54, Tom Lane a écrit :
 Robert Haas robertmh...@gmail.com writes:
 On Mon, Jun 21, 2010 at 12:46 PM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 I added a CHECK_FOR_INTERRUPTS call in the copy_relation_data(),
 copy_dir(), and copy_file() functions. Works for me on ALTER TABLE ...
 SET TABLESPACE and ALTER DATABASE ... SET TABLESPACE, in 9.0 and 8.4.

 Adding a CHECK_FOR_INTERRUPTS() to copy_relation_data seems like it
 ought to be OK (though I haven't tested), but copydir() is in
 src/port, and I fear that putting CHECK_FOR_INTERRUPTS() in there
 might cause problems.

 copydir.c is already backend-specific thanks to all the ereport calls.
 If we ever tried to make it usable in frontend code, we could easily
 deal with CHECK_FOR_INTERRUPTS() via #ifndef FRONTEND --- changing the
 error management would be far more painful.

 
 I'm not sure I get it right. Do I need to do something on the patch so
 that it can get commited?
 

Still not sure what to do right now for this patch :)

Could it be applied? or should I work on it? (and if yes on the latter,
to do what?)

Thanks.



-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.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] Cannot cancel the change of a tablespace

2010-06-29 Thread Tom Lane
Guillaume Lelarge guilla...@lelarge.info writes:
 Still not sure what to do right now for this patch :)

Put it on the commitfest list, if you didn't already.

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] Cannot cancel the change of a tablespace

2010-06-29 Thread Bruce Momjian
Tom Lane wrote:
 Guillaume Lelarge guilla...@lelarge.info writes:
  Still not sure what to do right now for this patch :)
 
 Put it on the commitfest list, if you didn't already.

So this is not something we want fixed for 9.0, as indicated by Simon?
I don't see the patch on the commit-fest page yet.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + None of us is going to be here forever. +

-- 
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] Cannot cancel the change of a tablespace

2010-06-29 Thread Robert Haas
On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 Tom Lane wrote:
 Guillaume Lelarge guilla...@lelarge.info writes:
  Still not sure what to do right now for this patch :)

 Put it on the commitfest list, if you didn't already.

 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

I tend to think we should fix it for 9.0, but could be talked out of
it if someone has a compelling argument to make.

-- 
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
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] Cannot cancel the change of a tablespace

2010-06-29 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.

 I tend to think we should fix it for 9.0, but could be talked out of
 it if someone has a compelling argument to make.

Er, maybe I lost count, but I thought you were the one objecting to
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] Cannot cancel the change of a tablespace

2010-06-29 Thread Guillaume Lelarge
Le 30/06/2010 05:25, Tom Lane a écrit :
 Robert Haas robertmh...@gmail.com writes:
 On Tue, Jun 29, 2010 at 9:42 PM, Bruce Momjian br...@momjian.us wrote:
 So this is not something we want fixed for 9.0, as indicated by Simon?
 I don't see the patch on the commit-fest page yet.
 
 I tend to think we should fix it for 9.0, but could be talked out of
 it if someone has a compelling argument to make.
 
 Er, maybe I lost count, but I thought you were the one objecting to
 the patch.
 

You're right. Robert questioned the use of CHECK_FOR_INTERRUPTS() in
code available in the src/port directory. I don't see what issue could
result with this. He also said that whatever would be commited should be
back-patched.

I can still add it for the next commit fest, I just don't want this
patch to get lost. Though I won't be able to do this before getting back
from work.

Thanks.


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.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] Cannot cancel the change of a tablespace

2010-06-23 Thread Robert Haas
On Mon, Jun 21, 2010 at 12:46 PM, Guillaume Lelarge
guilla...@lelarge.info wrote:
 Today, I tried to cancel the change of a tablespace for a table (ALTER
 TABLE ... SET TABLESPACE). I got the Cancel request sent but the query
 continued and finally succeed. It was a big issue for my customer, and I
 wanted to look more into that issue. So, I got a look at the source code
 and found we didn't check for interrupts in this part of the code. I
 added them, and it seems to work as I wanted.

 I added a CHECK_FOR_INTERRUPTS call in the copy_relation_data(),
 copy_dir(), and copy_file() functions. Works for me on ALTER TABLE ...
 SET TABLESPACE and ALTER DATABASE ... SET TABLESPACE, in 9.0 and 8.4.

 Not sure we really want that change, and it don't feel like a bug to me.
 Should I add it to to the next commitfest?

Adding a CHECK_FOR_INTERRUPTS() to copy_relation_data seems like it
ought to be OK (though I haven't tested), but copydir() is in
src/port, and I fear that putting CHECK_FOR_INTERRUPTS() in there
might cause problems.

I think that whatever portion of this we end up applying should be back-patched.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise Postgres Company

-- 
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] Cannot cancel the change of a tablespace

2010-06-23 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes:
 On Mon, Jun 21, 2010 at 12:46 PM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 I added a CHECK_FOR_INTERRUPTS call in the copy_relation_data(),
 copy_dir(), and copy_file() functions. Works for me on ALTER TABLE ...
 SET TABLESPACE and ALTER DATABASE ... SET TABLESPACE, in 9.0 and 8.4.

 Adding a CHECK_FOR_INTERRUPTS() to copy_relation_data seems like it
 ought to be OK (though I haven't tested), but copydir() is in
 src/port, and I fear that putting CHECK_FOR_INTERRUPTS() in there
 might cause problems.

copydir.c is already backend-specific thanks to all the ereport calls.
If we ever tried to make it usable in frontend code, we could easily
deal with CHECK_FOR_INTERRUPTS() via #ifndef FRONTEND --- changing the
error management would be far more painful.

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] Cannot cancel the change of a tablespace

2010-06-23 Thread Guillaume Lelarge
Le 23/06/2010 22:54, Tom Lane a écrit :
 Robert Haas robertmh...@gmail.com writes:
 On Mon, Jun 21, 2010 at 12:46 PM, Guillaume Lelarge
 guilla...@lelarge.info wrote:
 I added a CHECK_FOR_INTERRUPTS call in the copy_relation_data(),
 copy_dir(), and copy_file() functions. Works for me on ALTER TABLE ...
 SET TABLESPACE and ALTER DATABASE ... SET TABLESPACE, in 9.0 and 8.4.
 
 Adding a CHECK_FOR_INTERRUPTS() to copy_relation_data seems like it
 ought to be OK (though I haven't tested), but copydir() is in
 src/port, and I fear that putting CHECK_FOR_INTERRUPTS() in there
 might cause problems.
 
 copydir.c is already backend-specific thanks to all the ereport calls.
 If we ever tried to make it usable in frontend code, we could easily
 deal with CHECK_FOR_INTERRUPTS() via #ifndef FRONTEND --- changing the
 error management would be far more painful.
 

I'm not sure I get it right. Do I need to do something on the patch so
that it can get commited?


-- 
Guillaume
 http://www.postgresql.fr
 http://dalibo.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] Cannot cancel the change of a tablespace

2010-06-21 Thread Simon Riggs
On Mon, 2010-06-21 at 18:46 +0200, Guillaume Lelarge wrote:

 Today, I tried to cancel the change of a tablespace for a table (ALTER
 TABLE ... SET TABLESPACE). I got the Cancel request sent but the query
 continued and finally succeed. It was a big issue for my customer, and I
 wanted to look more into that issue. So, I got a look at the source code
 and found we didn't check for interrupts in this part of the code. I
 added them, and it seems to work as I wanted.
 
 I added a CHECK_FOR_INTERRUPTS call in the copy_relation_data(),
 copy_dir(), and copy_file() functions. Works for me on ALTER TABLE ...
 SET TABLESPACE and ALTER DATABASE ... SET TABLESPACE, in 9.0 and 8.4.
 
 Not sure we really want that change, and it don't feel like a bug to me.
 Should I add it to to the next commitfest?

Patch looks fine to me. Seems important.

Will apply tomorrow to 9.0, barring objections.

-- 
 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] cannot compile CVS HEAD

2009-12-02 Thread Heikki Linnakangas
Pavel Stehule wrote:
 I have a problem with compilation:
 
 make[4]: Entering directory `/home/pavel/src/pgsql/src/backend/utils/adt'
 gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
 -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
 -fwrapv -I../../../../src/include -D_GNU_SOURCE   -c -o int.o int.c
 int.c: In function ‘int4xor’:
 int.c:1209: error: ‘arg2’ undeclared (first use in this function)
 int.c:1209: error: (Each undeclared identifier is reported only once
 int.c:1209: error: for each function it appears in.)
 int.c:1207: warning: unused variable ‘arg20’
 make[4]: *** [int.o] Error 1

That's bizarre. Works fine for me. Looks like the local variable is
called arg20 instead of arg2 in your workspace for some reason. You
sure you didn't accidentally fumble that?

-- 
  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] cannot compile CVS HEAD

2009-12-02 Thread Pavel Stehule
2009/12/2 Heikki Linnakangas heikki.linnakan...@enterprisedb.com:
 Pavel Stehule wrote:
 I have a problem with compilation:

 make[4]: Entering directory `/home/pavel/src/pgsql/src/backend/utils/adt'
 gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith
 -Wdeclaration-after-statement -Wendif-labels -fno-strict-aliasing
 -fwrapv -I../../../../src/include -D_GNU_SOURCE   -c -o int.o int.c
 int.c: In function ‘int4xor’:
 int.c:1209: error: ‘arg2’ undeclared (first use in this function)
 int.c:1209: error: (Each undeclared identifier is reported only once
 int.c:1209: error: for each function it appears in.)
 int.c:1207: warning: unused variable ‘arg20’
 make[4]: *** [int.o] Error 1

 That's bizarre. Works fine for me. Looks like the local variable is
 called arg20 instead of arg2 in your workspace for some reason. You
 sure you didn't accidentally fumble that?

it is some strange - maybe some hw problem :(

Pavel


 --
  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] Cannot use all four trigger events at once

2009-06-18 Thread Simon Riggs

On Wed, 2009-06-17 at 16:22 -0400, Greg Sabino Mullane wrote:
 This was failing:
 
 CREATE TRIGGER foo
 AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE
 ON foobar
 FOR EACH STATEMENT EXECUTE PROCEDURE baz();
 
 Turns out the parser wasn't set up to handle four different trigger
 event types. Patch attached.

Thanks for fixing Greg.

-- 
 Simon Riggs   www.2ndQuadrant.com
 PostgreSQL Training, Services and 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] Cannot use all four trigger events at once

2009-06-17 Thread Tom Lane
Greg Sabino Mullane g...@turnstep.com writes:
 This was failing:
 CREATE TRIGGER foo
 AFTER INSERT OR UPDATE OR DELETE OR TRUNCATE
 ON foobar
 FOR EACH STATEMENT EXECUTE PROCEDURE baz();

 Turns out the parser wasn't set up to handle four different trigger
 event types.

Hmm, that's a problem ...

 Patch attached.

... but this patch doesn't come close to fixing it.  struct CreateTrigStmt
needs changes.  I kinda think the restriction to 4 (or whatever)
elements ought to go away altogether.

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] Cannot use all four trigger events at once

2009-06-17 Thread Greg Sabino Mullane

-BEGIN PGP SIGNED MESSAGE-   
Hash: RIPEMD160  
NotDashEscaped: You need GnuPG to verify this message


 ... but this patch doesn't come close to fixing it.  struct CreateTrigStmt
 needs changes.  I kinda think the restriction to 4 (or whatever)  
 elements ought to go away altogether. 

Thanks. I'll leave the [5] restriction call to someone else, seems it 
does no harm to me though (not as if we'd change it that often anyway).
Revised patch below. I looked through other places that might be affected, 
but did not see anything else except ecpg/preproc/preproc.y, which 
looks as though it's already been changed to handle four events.   


Index: src/backend/parser/gram.y
===
RCS file: /projects/cvsroot/pgsql/src/backend/parser/gram.y,v  
retrieving revision 2.664  
diff -c -r2.664 gram.y 
*** src/backend/parser/gram.y   27 May 2009 20:42:29 -  2.664
--- src/backend/parser/gram.y   18 Jun 2009 00:44:15 -   
***  
*** 3133,3139    
n-args = $13;   
n-before = $4;  
n-row = $8; 
!   memcpy(n-actions, $5, 4);   
n-isconstraint  = FALSE;
n-deferrable= FALSE;
n-initdeferred  = FALSE;
--- 3133,3139    
n-args = $13;   
n-before = $4;  
n-row = $8; 
!   memcpy(n-actions, $5, 5);   
n-isconstraint  = FALSE;
n-deferrable= FALSE;
n-initdeferred  = FALSE;
***  
*** 3153,3159    
n-args = $18;   
n-before = FALSE;   
n-row = TRUE;   
!   memcpy(n-actions, $6, 4);   
n-isconstraint  = TRUE; 
n-deferrable = ($10  1) != 0;
n-initdeferred = ($10  2) != 0;
--- 3153,3159    
n-args = $18;   
n-before = FALSE;   
n-row = TRUE;   
!   memcpy(n-actions, $6, 5);   
n-isconstraint  = TRUE; 
n-deferrable = ($10  1) != 0;  
n-initdeferred = ($10  2) != 0;
***  
*** 3171,3192    
  TriggerEvents: 
TriggerOneEvent  
{
!   char *e = palloc(4); 
e[0] = $1; e[1] = '\0';  
$$ = e;  
}
| TriggerOneEvent OR TriggerOneEvent 
{
!   char *e = palloc(4); 
e[0] = $1; e[1] = $3; e[2] = '\0';
$$ = e;   
} 
| TriggerOneEvent OR TriggerOneEvent OR TriggerOneEvent
{  
!   char *e = palloc(4);   

Re: [HACKERS] Cannot use all four trigger events at once

2009-06-17 Thread Tom Lane
Greg Sabino Mullane g...@turnstep.com writes:
 Thanks. I'll leave the [5] restriction call to someone else, seems it 
 does no harm to me though (not as if we'd change it that often anyway).
 Revised patch below. I looked through other places that might be affected, 
 but did not see anything else except ecpg/preproc/preproc.y, which 
 looks as though it's already been changed to handle four events.   

preproc.y is a derived file nowadays, so if you looked at it after
having fixed gram.y it would've looked fixed.  However, I felt we
should fix this code properly instead of propagating its existing
klugy approach still further.  It gets a whole lot simpler and shorter
if you make the grammar produce the bitmap representation that trigger.c
actually wants; as per attached applied patch.

regards, tom lane


Index: src/backend/commands/tablecmds.c
===
RCS file: /cvsroot/pgsql/src/backend/commands/tablecmds.c,v
retrieving revision 1.287
diff -c -r1.287 tablecmds.c
*** src/backend/commands/tablecmds.c11 Jun 2009 20:46:11 -  1.287
--- src/backend/commands/tablecmds.c18 Jun 2009 01:13:04 -
***
*** 5206,5219 
if (on_insert)
{
fk_trigger-funcname = SystemFuncName(RI_FKey_check_ins);
!   fk_trigger-actions[0] = 'i';
}
else
{
fk_trigger-funcname = SystemFuncName(RI_FKey_check_upd);
!   fk_trigger-actions[0] = 'u';
}
-   fk_trigger-actions[1] = '\0';
  
fk_trigger-isconstraint = true;
fk_trigger-deferrable = fkconstraint-deferrable;
--- 5206,5218 
if (on_insert)
{
fk_trigger-funcname = SystemFuncName(RI_FKey_check_ins);
!   fk_trigger-events = TRIGGER_TYPE_INSERT;
}
else
{
fk_trigger-funcname = SystemFuncName(RI_FKey_check_upd);
!   fk_trigger-events = TRIGGER_TYPE_UPDATE;
}
  
fk_trigger-isconstraint = true;
fk_trigger-deferrable = fkconstraint-deferrable;
***
*** 5263,5271 
fk_trigger-relation = fkconstraint-pktable;
fk_trigger-before = false;
fk_trigger-row = true;
!   fk_trigger-actions[0] = 'd';
!   fk_trigger-actions[1] = '\0';
! 
fk_trigger-isconstraint = true;
fk_trigger-constrrel = myRel;
switch (fkconstraint-fk_del_action)
--- 5262,5268 
fk_trigger-relation = fkconstraint-pktable;
fk_trigger-before = false;
fk_trigger-row = true;
!   fk_trigger-events = TRIGGER_TYPE_DELETE;
fk_trigger-isconstraint = true;
fk_trigger-constrrel = myRel;
switch (fkconstraint-fk_del_action)
***
*** 5316,5323 
fk_trigger-relation = fkconstraint-pktable;
fk_trigger-before = false;
fk_trigger-row = true;
!   fk_trigger-actions[0] = 'u';
!   fk_trigger-actions[1] = '\0';
fk_trigger-isconstraint = true;
fk_trigger-constrrel = myRel;
switch (fkconstraint-fk_upd_action)
--- 5313,5319 
fk_trigger-relation = fkconstraint-pktable;
fk_trigger-before = false;
fk_trigger-row = true;
!   fk_trigger-events = TRIGGER_TYPE_UPDATE;
fk_trigger-isconstraint = true;
fk_trigger-constrrel = myRel;
switch (fkconstraint-fk_upd_action)
Index: src/backend/commands/trigger.c
===
RCS file: /cvsroot/pgsql/src/backend/commands/trigger.c,v
retrieving revision 1.247
diff -c -r1.247 trigger.c
*** src/backend/commands/trigger.c  11 Jun 2009 14:48:56 -  1.247
--- src/backend/commands/trigger.c  18 Jun 2009 01:13:04 -
***
*** 100,106 
Oid funcoid;
Oid funcrettype;
Oid trigoid;
-   int i;
charconstrtrigname[NAMEDATALEN];
char   *trigname;
char   *constrname;
--- 100,105 
***
*** 150,199 
TRIGGER_SETT_BEFORE(tgtype);
if (stmt-row)
TRIGGER_SETT_ROW(tgtype);
  
!   for (i = 0; stmt-actions[i]; i++)
!   {
!   switch (stmt-actions[i])
!   {
!   case 'i':
!   if (TRIGGER_FOR_INSERT(tgtype))
!   ereport(ERROR,
!   
(errcode(ERRCODE_SYNTAX_ERROR),
!errmsg(multiple 
INSERT events specified)));
!   TRIGGER_SETT_INSERT(tgtype);
!   break;
!   case 'd':
!   if (TRIGGER_FOR_DELETE(tgtype))
!

Re: [HACKERS] cannot update to the latest CVS sources

2009-06-12 Thread Bruce Momjian
Fujii Masao wrote:
 Hi,
 
 $ cvs update
 
 cvs update: Updating src/backend/commands
 cvs update: [08:32:37] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:33:07] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:33:37] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:34:07] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:34:37] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:35:07] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 
 The cvs's lock remains held? Why?

Seems OK from my computer.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + 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] cannot update to the latest CVS sources

2009-06-12 Thread Kevin Grittner
Bruce Momjian br...@momjian.us wrote:
 Fujii Masao wrote:
 
 $ cvs update
 
 cvs update: Updating src/backend/commands
 cvs update: [08:32:37] waiting for anoncvs's lock in
 
 Seems OK from my computer.
 
I'm having the problem.  Same directory.
 
-Kevin


-- 
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] cannot update to the latest CVS sources

2009-06-12 Thread Tom Lane
Bruce Momjian br...@momjian.us writes:
 Fujii Masao wrote:
 The cvs's lock remains held? Why?

 Seems OK from my computer.

Were you checking anoncvs or the master?

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] cannot update to the latest CVS sources

2009-06-12 Thread Bruce Momjian
Tom Lane wrote:
 Bruce Momjian br...@momjian.us writes:
  Fujii Masao wrote:
  The cvs's lock remains held? Why?
 
  Seems OK from my computer.
 
 Were you checking anoncvs or the master?

Oh, sorry, I was checking master.

-- 
  Bruce Momjian  br...@momjian.ushttp://momjian.us
  EnterpriseDB http://enterprisedb.com

  + 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] cannot update to the latest CVS sources

2009-06-12 Thread Dave Page
On Fri, Jun 12, 2009 at 9:45 AM, Fujii Masaomasao.fu...@gmail.com wrote:
 Hi,

 $ cvs update
 
 cvs update: Updating src/backend/commands
 cvs update: [08:32:37] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:33:07] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:33:37] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:34:07] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:34:37] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands
 cvs update: [08:35:07] waiting for anoncvs's lock in
 /projects/cvsroot/pgsql/src/backend/commands

 The cvs's lock remains held? Why?

Please try now.

-- 
Dave Page
EnterpriseDB UK:   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


  1   2   >