Re: [HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-28 Thread Simon Riggs
On 24 June 2013 22:17, Simon Riggs si...@2ndquadrant.com wrote:

 On 24 June 2013 21:42, Jeff Janes jeff.ja...@gmail.com wrote:

 On Sun, Jun 23, 2013 at 8:58 PM, Abhijit Menon-Sen 
 a...@2ndquadrant.comwrote:

 At 2013-06-08 21:45:24 +0100, si...@2ndquadrant.com wrote:
 
  ALTER TABLE foo
 ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;

 I read the patch (looks good), applied it on HEAD (fine), ran make check
 (fine), and played with it in a test database. It looks great, and from
 previous responses it's something a lot of people have wished for.

 I'm marking this ready for committer.


 After the commit, I'm now getting the compiler warning:

 tablecmds.c: In function 'ATPrepCmd':
 tablecmds.c:2953: warning: 'pass' may be used uninitialized in this
 function


 case AT_AlterConstraint (line 3130) is the only case branch that does not
 set pass.


 The investigation is into why my current compiler didn't report that.
 Thanks though.


Looks like that really is a deficiency in my tool chain on OSX, rather than
some bug/user error. Even at the very latest, very shiny version.

Latest versions of gcc trap the error, so I'll have to investigate an
alternative.

-- 
 Simon Riggs   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


Re: [HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-28 Thread Alvaro Herrera
Simon Riggs escribió:

 Looks like that really is a deficiency in my tool chain on OSX, rather than
 some bug/user error. Even at the very latest, very shiny version.
 
 Latest versions of gcc trap the error, so I'll have to investigate an
 alternative.

Funnily enough, on Debian Wheezy with gcc 4.7.2 I don't get the warning,
and Andres with gcc 4.7.3 (from Debian unstable) does see it.  (Of
course, the 4.8 version shipped with unstable also shows it.)

Clang similarly requires pretty new versions to show the warning.

-- 
Á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] ALTER TABLE ... ALTER CONSTRAINT

2013-06-24 Thread Jeff Janes
On Sun, Jun 23, 2013 at 8:58 PM, Abhijit Menon-Sen a...@2ndquadrant.comwrote:

 At 2013-06-08 21:45:24 +0100, si...@2ndquadrant.com wrote:
 
  ALTER TABLE foo
 ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;

 I read the patch (looks good), applied it on HEAD (fine), ran make check
 (fine), and played with it in a test database. It looks great, and from
 previous responses it's something a lot of people have wished for.

 I'm marking this ready for committer.


After the commit, I'm now getting the compiler warning:

tablecmds.c: In function 'ATPrepCmd':
tablecmds.c:2953: warning: 'pass' may be used uninitialized in this function


case AT_AlterConstraint (line 3130) is the only case branch that does not
set pass.

Cheers,

Jeff


Re: [HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-24 Thread Simon Riggs
On 24 June 2013 21:42, Jeff Janes jeff.ja...@gmail.com wrote:

 On Sun, Jun 23, 2013 at 8:58 PM, Abhijit Menon-Sen 
 a...@2ndquadrant.comwrote:

 At 2013-06-08 21:45:24 +0100, si...@2ndquadrant.com wrote:
 
  ALTER TABLE foo
 ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;

 I read the patch (looks good), applied it on HEAD (fine), ran make check
 (fine), and played with it in a test database. It looks great, and from
 previous responses it's something a lot of people have wished for.

 I'm marking this ready for committer.


 After the commit, I'm now getting the compiler warning:

 tablecmds.c: In function 'ATPrepCmd':
 tablecmds.c:2953: warning: 'pass' may be used uninitialized in this
 function


 case AT_AlterConstraint (line 3130) is the only case branch that does not
 set pass.


The investigation is into why my current compiler didn't report that.
Thanks though.

-- 
 Simon Riggs   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


Re: [HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-23 Thread Abhijit Menon-Sen
At 2013-06-08 21:45:24 +0100, si...@2ndquadrant.com wrote:

 ALTER TABLE foo
ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;

I read the patch (looks good), applied it on HEAD (fine), ran make check
(fine), and played with it in a test database. It looks great, and from
previous responses it's something a lot of people have wished for.

I'm marking this ready for committer.

-- Abhijit


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


Re: [HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-10 Thread Dimitri Fontaine
Andres Freund and...@2ndquadrant.com writes:
 I haven't looked at the patch in detail, but I am very, very much in
 favor of the feature in general… I have wished for this more than once,

+1

-- 
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] ALTER TABLE ... ALTER CONSTRAINT

2013-06-10 Thread Michael Paquier
On Mon, Jun 10, 2013 at 11:06 PM, Dimitri Fontaine
dimi...@2ndquadrant.frwrote:

 Andres Freund and...@2ndquadrant.com writes:
  I haven't looked at the patch in detail, but I am very, very much in
  favor of the feature in general… I have wished for this more than once,

 +1

+1. It will be useful.
-- 
Michael


Re: [HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-09 Thread Andres Freund
On 2013-06-08 21:45:24 +0100, Simon Riggs wrote:
 While fiddling with FK tuning, it was useful to be able to enable and
 disable the DEFERRED mode of constraints.
 
 That is not currently possible in SQL, so I wrote this patch. Without
 this you have to drop and then re-add a constraint, which is
 impractical for large tables.
 
 e.g.
 CREATE TABLE fktable (id integer, fk integer REFERENCES pktable (id));
 
 ALTER TABLE foo
ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;
 
 Includes docs and tests.
 
 Currently works for FKs only. Potentially other constraints can be
 supported in future.

I haven't looked at the patch in detail, but I am very, very much in
favor of the feature in general… I have wished for this more than once,
and it certainly cost me more time working around it than it would have
cost to implement it.

Thanks,

Andres Freund

-- 
 Andres Freund http://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] ALTER TABLE ... ALTER CONSTRAINT

2013-06-09 Thread Kevin Grittner
Andres Freund and...@2ndquadrant.com wrote:
 On 2013-06-08 21:45:24 +0100, Simon Riggs wrote:

 ALTER TABLE foo
 ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;

 I haven't looked at the patch in detail, but I am very, very much in
 favor of the feature in general… I have wished for this more than once

+1

--
Kevin Grittner
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


[HACKERS] ALTER TABLE ... ALTER CONSTRAINT

2013-06-08 Thread Simon Riggs
While fiddling with FK tuning, it was useful to be able to enable and
disable the DEFERRED mode of constraints.

That is not currently possible in SQL, so I wrote this patch. Without
this you have to drop and then re-add a constraint, which is
impractical for large tables.

e.g.
CREATE TABLE fktable (id integer, fk integer REFERENCES pktable (id));

ALTER TABLE foo
   ALTER CONSTRAINT fktable_fk_fkey DEFERRED INITIALLY IMMEDIATE;

Includes docs and tests.

Currently works for FKs only. Potentially other constraints can be
supported in future.

--
 Simon Riggs   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training  Services


alter_table_alter_constraint.v1.sql
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