[COMMITTERS] pgsql: Ecpglib stores variables that are used in DECLARE statements in

2012-01-05 Thread Michael Meskes
Ecpglib stores variables that are used in DECLARE statements in a global list.
This list is now freed when the last connection has been closed.

Closes: #6366

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/8cf82ac53e9a3d5dd86f16106e3398063a526817

Modified Files
--
src/interfaces/ecpg/ecpglib/connect.c |7 +++
src/interfaces/ecpg/ecpglib/extern.h  |9 +
src/interfaces/ecpg/ecpglib/misc.c|7 +--
3 files changed, 17 insertions(+), 6 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] autodoc - autodoc: Update schema for Docbook 4.5.

2012-01-05 Thread User Rbt
Log Message:
---
Update schema for Docbook 4.5. Use  where possible.

Modified Files:
--
autodoc:
xml.tmpl (r1.2 -> r1.3)

(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/autodoc/autodoc/xml.tmpl?r1=1.2&r2=1.3)

-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] autodoc - autodoc: Mark 1.41 release

2012-01-05 Thread User Rbt
Log Message:
---
Mark 1.41 release

Modified Files:
--
autodoc:
postgresql_autodoc.pl (r1.29 -> r1.30)

(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/autodoc/autodoc/postgresql_autodoc.pl?r1=1.29&r2=1.30)

-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] autodoc - autodoc: 1.41 release notes

2012-01-05 Thread User Rbt
Log Message:
---
1.41 release notes

Modified Files:
--
autodoc:
ChangeLog (r1.12 -> r1.13)

(http://cvs.pgfoundry.org/cgi-bin/cvsweb.cgi/autodoc/autodoc/ChangeLog?r1=1.12&r2=1.13)

-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Work around perl bug in SvPVutf8().

2012-01-05 Thread Andrew Dunstan
Work around perl bug in SvPVutf8().

Certain things like typeglobs or readonly things like $^V cause
perl's SvPVutf8() to die nastily and crash the backend. To avoid
that bug we make a copy of the object, which will subsequently be
garbage collected.

Back patched to 9.1 where we first started using SvPVutf8().

Per -hackers discussion. Original problem reported by David Wheeler.

Branch
--
REL9_1_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/d496384d6771c276a0253758418e7933b6f31167

Modified Files
--
src/pl/plperl/plperl_helpers.h |8 +++-
1 files changed, 7 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Work around perl bug in SvPVutf8().

2012-01-05 Thread Andrew Dunstan
Work around perl bug in SvPVutf8().

Certain things like typeglobs or readonly things like $^V cause
perl's SvPVutf8() to die nastily and crash the backend. To avoid
that bug we make a copy of the object, which will subsequently be
garbage collected.

Back patched to 9.1 where we first started using SvPVutf8().

Per -hackers discussion. Original problem reported by David Wheeler.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/2abefd9a92f3c02ad4f6030ac1578bbf314db368

Modified Files
--
src/pl/plperl/plperl_helpers.h |8 +++-
1 files changed, 7 insertions(+), 1 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Improve ALTER DOMAIN / DROP CONSTRAINT with nonexistent constrai

2012-01-05 Thread Peter Eisentraut
Improve ALTER DOMAIN / DROP CONSTRAINT with nonexistent constraint

ALTER DOMAIN / DROP CONSTRAINT on a nonexistent constraint name did
not report any error.  Now it reports an error.  The IF EXISTS option
was added to get the usual behavior of ignoring nonexistent objects to
drop.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/104e7dac28c56dcaf9b778dff60a5daefc3a0661

Modified Files
--
doc/src/sgml/ref/alter_domain.sgml   |6 --
src/backend/commands/typecmds.c  |   17 -
src/backend/nodes/copyfuncs.c|1 +
src/backend/nodes/equalfuncs.c   |1 +
src/backend/parser/gram.y|   12 
src/backend/tcop/utility.c   |3 ++-
src/include/commands/typecmds.h  |2 +-
src/include/nodes/parsenodes.h   |1 +
src/test/regress/expected/domain.out |4 
src/test/regress/sql/domain.sql  |3 +++
10 files changed, 45 insertions(+), 5 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: pg_dump: Dump operators with the same name ordered by arity

2012-01-05 Thread Peter Eisentraut
pg_dump: Dump operators with the same name ordered by arity

pg_dump sorts operators by name, but operators with the same name come
out in random order.  Now operators with the same name are dumped in
the order prefix, postfix, infix.  (This is consistent with functions,
which are dumped in increasing number of argument order.)

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/15df037845d9d3d99e9e2b4370256b136b00c66a

Modified Files
--
src/bin/pg_dump/pg_dump.c  |6 ++
src/bin/pg_dump/pg_dump.h  |1 +
src/bin/pg_dump/pg_dump_sort.c |   10 ++
3 files changed, 17 insertions(+), 0 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: pg_dump: Dump foreign options in prettier format

2012-01-05 Thread Peter Eisentraut
pg_dump: Dump foreign options in prettier format

Dump them using line breaks and indentation instead of everything on
one line.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/7e53515480853604aac825bd3e53e7f9716632b4

Modified Files
--
src/bin/pg_dump/pg_dump.c |   22 +++---
1 files changed, 11 insertions(+), 11 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

2012-01-05 Thread Andrew Dunstan
Fix breakage from earlier plperl fix.

Apparently the perl garbage collector was a bit too eager, so here
we control when the new SV is garbage collected.

Branch
--
REL9_1_STABLE

Details
---
http://git.postgresql.org/pg/commitdiff/d1d836f92c0798f4bc4138dc6b87279199c4f49a

Modified Files
--
src/pl/plperl/plperl_helpers.h |   23 +++
1 files changed, 15 insertions(+), 8 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


[COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

2012-01-05 Thread Andrew Dunstan
Fix breakage from earlier plperl fix.

Apparently the perl garbage collector was a bit too eager, so here
we control when the new SV is garbage collected.

Branch
--
master

Details
---
http://git.postgresql.org/pg/commitdiff/bd0e74a9ce98c65c94565fb603dcc7b710cd4227

Modified Files
--
src/pl/plperl/plperl_helpers.h |   23 +++
1 files changed, 15 insertions(+), 8 deletions(-)


-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Re: [COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

2012-01-05 Thread Alex Hunsaker
On Thu, Jan 5, 2012 at 16:02, Andrew Dunstan  wrote:
> Fix breakage from earlier plperl fix.
>
> Apparently the perl garbage collector was a bit too eager, so here
> we control when the new SV is garbage collected.

I know im a little late to the party...

I can't help but think this seems a bit inefficient for the common
case. Would it be worth only copying the sv when its a glob or
readonly? Something like the below? I tested a few more svtypes that
were easy to make (code, regexp) and everything seems peachy.

[ BTW it seems readonly in general is fine, for example elog(ERROR,
1); worked previously as well as elog(ERROR, "1");. Both of those sv's
are readonly. ISTM, at least on my version of perl (5.14.2), globs and
readonly vstrings seem to be the problem children. I think we could
get away with testing if its a glob or vstring. But I don't have time
right now to test all the way back to perl 5.8 and everything
in-between, Ill find it if anyone is interested.  ]

--

*** a/src/pl/plperl/plperl_helpers.h
--- b/src/pl/plperl/plperl_helpers.h
***
*** 47,53  sv2cstr(SV *sv)
  {
char   *val, *res;
STRLEN  len;
-   SV *nsv;

/*
 * get a utf8 encoded char * out of perl. *note* it may not be valid 
utf8!
--- 47,52 
***
*** 58,65  sv2cstr(SV *sv)
 * sv before passing it to SvPVutf8(). The copy is garbage collected
 * when we're done with it.
 */
!   nsv = newSVsv(sv);
!   val = SvPVutf8(nsv, len);

/*
 * we use perl's length in the event we had an embedded null byte to 
ensure
--- 57,68 
 * sv before passing it to SvPVutf8(). The copy is garbage collected
 * when we're done with it.
 */
!   if(SvTYPE(sv) == SVt_PVGV || SvREADONLY(sv))
!   sv = newSVsv(sv);
!   else
!   SvREFCNT_inc(sv);
!
!   val = SvPVutf8(sv, len);

/*
 * we use perl's length in the event we had an embedded null byte to 
ensure
***
*** 68,74  sv2cstr(SV *sv)
res =  utf_u2e(val, len);

/* safe now to garbage collect the new SV */
!   SvREFCNT_dec(nsv);

return res;
  }
--- 71,77 
res =  utf_u2e(val, len);

/* safe now to garbage collect the new SV */
!   SvREFCNT_dec(sv);

return res;
  }

-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Re: [COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

2012-01-05 Thread Andrew Dunstan



On 01/05/2012 06:31 PM, Alex Hunsaker wrote:

On Thu, Jan 5, 2012 at 16:02, Andrew Dunstan  wrote:

Fix breakage from earlier plperl fix.

Apparently the perl garbage collector was a bit too eager, so here
we control when the new SV is garbage collected.

I know im a little late to the party...

I can't help but think this seems a bit inefficient for the common
case. Would it be worth only copying the sv when its a glob or
readonly? Something like the below? I tested a few more svtypes that
were easy to make (code, regexp) and everything seems peachy.



I'm not so concerned about elog() use, and anyway there the most common 
case surely will be passing a readonly string.


I'm more concerned about all the other places we call sv2cstr().

"SvTYPE(sv) == SVt_PVGV" is what I was looking for in vain in the perl docs.

So, yes, we should probably adjust this one more time, but ideally we 
need a better test than just SvREADONLY(). If you want to follow up your 
investigation of exactly when we need a copied SV and see how much you 
can narrow it down that would be great.


cheers

andrew



--
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Re: [COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

2012-01-05 Thread Alex Hunsaker
On Thu, Jan 5, 2012 at 16:59, Andrew Dunstan  wrote:
>
>
> On 01/05/2012 06:31 PM, Alex Hunsaker wrote:
>>
>> On Thu, Jan 5, 2012 at 16:02, Andrew Dunstan  wrote:
>>>
>>> Fix breakage from earlier plperl fix.

>> I can't help but think this seems a bit inefficient
>
> So, yes, we should probably adjust this one more time, but ideally we need a
> better test than just SvREADONLY(). If you want to follow up your
> investigation of exactly when we need a copied SV and see how much you can
> narrow it down that would be great.

After further digging I found it chokes on any non scalar (IOW any
reference). I attached a simple c program that I tested with 5.8.9,
5.10.1, 5.12.4 and 5.14.2 (for those who did not know about it,
perlbrew made testing across all those perls relatively painless).

PFA that copies if its readonly and its not a scalar. Also I fixed up
Tom's complaint about having sv2cstr() inside do_util_elog's PG_TRY
block. I didn't bother fixing the ones in plperl.c tho-- some seemed
like they would require quite a bit of rejiggering.

I didn't bother adding regression tests-- should I have?
*** a/src/pl/plperl/Util.xs
--- b/src/pl/plperl/Util.xs
***
*** 37,47  static void
  do_util_elog(int level, SV *msg)
  {
  	MemoryContext oldcontext = CurrentMemoryContext;
! 	char	   * volatile cmsg = NULL;
  
  	PG_TRY();
  	{
- 		cmsg = sv2cstr(msg);
  		elog(level, "%s", cmsg);
  		pfree(cmsg);
  	}
--- 37,46 
  do_util_elog(int level, SV *msg)
  {
  	MemoryContext oldcontext = CurrentMemoryContext;
! 	char	   * volatile cmsg = sv2cstr(msg);
  
  	PG_TRY();
  	{
  		elog(level, "%s", cmsg);
  		pfree(cmsg);
  	}
*** a/src/pl/plperl/plperl_helpers.h
--- b/src/pl/plperl/plperl_helpers.h
***
*** 47,74  sv2cstr(SV *sv)
  {
  	char	   *val, *res;
  	STRLEN		len;
! 	SV *nsv;
  
  	/*
  	 * get a utf8 encoded char * out of perl. *note* it may not be valid utf8!
  	 *
! 	 * SvPVutf8() croaks nastily on certain things, like typeglobs and
! 	 * readonly objects such as $^V. That's a perl bug - it's not supposed to
! 	 * happen. To avoid crashing the backend, we make a copy of the
! 	 * sv before passing it to SvPVutf8(). The copy is garbage collected 
! 	 * when we're done with it.
  	 */
! 	nsv = newSVsv(sv);
! 	val = SvPVutf8(nsv, len);
  
  	/*
  	 * we use perl's length in the event we had an embedded null byte to ensure
  	 * we error out properly
  	 */
! 	res =  utf_u2e(val, len);
  
  	/* safe now to garbage collect the new SV */
! 	SvREFCNT_dec(nsv);
  
  	return res;
  }
--- 47,79 
  {
  	char	   *val, *res;
  	STRLEN		len;
! 	svtype		type = SvTYPE(sv);
  
  	/*
  	 * get a utf8 encoded char * out of perl. *note* it may not be valid utf8!
  	 *
! 	 * SvPVutf8() croaks nastily on readonly refs, That's a perl bug - it's not
! 	 * supposed to happen. To avoid crashing the backend, we make a copy of the
! 	 * sv before passing it to SvPVutf8().
  	 */
! 	if (SvREADONLY(sv) &&
! 			(type != SVt_IV ||
! 			type != SVt_NV ||
! 			type != SVt_PV))
! 		sv = newSVsv(sv);
! 	else
! 		SvREFCNT_inc(sv);
! 
! 	val = SvPVutf8(sv, len);
  
  	/*
  	 * we use perl's length in the event we had an embedded null byte to ensure
  	 * we error out properly
  	 */
! 	res = utf_u2e(val, len);
  
  	/* safe now to garbage collect the new SV */
! 	SvREFCNT_dec(sv);
  
  	return res;
  }
/*
 * compile with gcc  -O2 -ggdb `perl -MExtUtils::Embed -e ccopts -e ldopts` svutf8_ro_test.c
 */
#include 
#include 

int main(void)
{
	char *embed[] = { "", "-e", "0" };
	int x;
	AV	*test;
	PerlInterpreter *perl;

	perl_construct(perl);
	perl_parse(perl, NULL, 3, embed, NULL);
	perl_run(perl);

	eval_pv("my $scalar = 'string';"
			"@test = ("
			"'string', "
			"$scalar, "
			"\\$scalar, "
			"1, "
			"1.5, "
			"[], "
			"{}, "
			"$^V, ,"
			"v5.0.0, "
			"sub {}, "
			"qr//, "
			"*STDIN, "
			"bless({}, ''), "
			");", 1);

	test = get_av("test", 0);
	for(x=0; x<=av_len(test); x++)
	{
		char *crap;
		STRLEN len;
		SV *sv = *av_fetch(test, x, 0);
		svtype type = SvTYPE(sv);

		SvREADONLY_on(sv);

		if (SvREADONLY(sv) &&
type != SVt_IV ||
type != SVt_NV ||
type != SVt_PV)
			sv = newSVsv(sv);

		crap = SvPVutf8(sv, len);
	}

	perl_destruct(perl);
	perl_free(perl);

	return 0;
}

-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers


Re: [COMMITTERS] pgsql: Fix breakage from earlier plperl fix.

2012-01-05 Thread Tom Lane
Alex Hunsaker  writes:
> PFA that copies if its readonly and its not a scalar. Also I fixed up
> Tom's complaint about having sv2cstr() inside do_util_elog's PG_TRY
> block.

On reflection I don't believe that just moving that call will improve
matters.  sv2cstr also contains a palloc, and if that throws an error,
it had better do so within a PG error context not the Perl one.

Making things safer will most likely require refactoring sv2cstr to
keep the Perl and PG operations entirely separate.

regards, tom lane

-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers