Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Fabrízio de Royes Mello
2012/10/2 Fabrízio de Royes Mello fabriziome...@gmail.com You're right... the latest proposed patch don't implements it. I'll change the patch and send soon... What is more reasonable? * show a syntax error or * show a message that you can not use the INE with contained objects Regards,

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Alvaro Herrera
Excerpts from Fabrízio de Royes Mello's message of mié oct 03 09:27:41 -0300 2012: 2012/10/2 Fabrízio de Royes Mello fabriziome...@gmail.com You're right... the latest proposed patch don't implements it. I'll change the patch and send soon... What is more reasonable? * show a

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Fabrízio de Royes Mello
2012/10/3 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Fabrízio de Royes Mello's message of mié oct 03 09:27:41 -0300 2012: 2012/10/2 Fabrízio de Royes Mello fabriziome...@gmail.com You're right... the latest proposed patch don't implements it. I'll change the patch and

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Alvaro Herrera
Excerpts from Fabrízio de Royes Mello's message of mié oct 03 10:11:03 -0300 2012: Maybe something like this? ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(IF NOT EXISTS cannot be used with schema elements), parser_errposition(@9)));

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Fabrízio de Royes Mello
2012/10/3 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Fabrízio de Royes Mello's message of mié oct 03 10:11:03 -0300 2012: Maybe something like this? ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(IF NOT EXISTS cannot be used with

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Tom Lane
=?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: The attached patch implements the behavior we've discussed. OK, I'll pick this up again, since we seem to have consensus on this behavior. regards, tom lane -- Sent via pgsql-hackers mailing

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread Tom Lane
=?ISO-8859-1?Q?Fabr=EDzio_de_Royes_Mello?= fabriziome...@gmail.com writes: The attached patch implements the behavior we've discussed. Committed with some adjustments, notably repairing the order-of-operations error I complained about before. regards, tom lane -- Sent

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-03 Thread David E. Wheeler
On Oct 3, 2012, at 4:49 PM, Tom Lane t...@sss.pgh.pa.us wrote: Committed with some adjustments, notably repairing the order-of-operations error I complained about before. Awesome, thanks! David -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Alvaro Herrera
The fundamental issue with this patch hasn't been answered sufficiently, I think. Consider the following sequence of commands: create schema if not exists foo create table first (a int); create schema if not exists foo create table second (a int); As far as I can see, with the patch as it

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Alvaro Herrera
Excerpts from Volker Grabsch's message of sáb sep 29 06:32:13 -0300 2012: Dickson S. Guedes schrieb: - https://commitfest.postgresql.org/action/patch_view?id=907 The patch is small and implements a new syntax to CREATE SCHEMA that allow the creation of a schema be skipped when IF NOT

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread David E. Wheeler
On Oct 2, 2012, at 12:08 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: create schema if not exists foo create table first (a int); create schema if not exists foo create table second (a int); As far as I can see, with the patch as it currently stands, you would end up with only table

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Alvaro Herrera
Excerpts from David E. Wheeler's message of mar oct 02 16:16:37 -0300 2012: On Oct 2, 2012, at 12:08 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: create schema if not exists foo create table first (a int); create schema if not exists foo create table second (a int); As far as

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread David E. Wheeler
On Oct 2, 2012, at 12:30 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: How about call this for precedent: mkdir -p /tmp/foo/bar mkdir -p /tmp/foo/baz In this case you end up with directory foo and at least two subdirs in it, bar and baz. This works even if /tmp/foo existed

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Tom Lane
Alvaro Herrera alvhe...@2ndquadrant.com writes: Excerpts from David E. Wheeler's message of mar oct 02 16:16:37 -0300 2012: On Oct 2, 2012, at 12:08 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: create schema if not exists foo create table first (a int); create schema if not exists foo

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Alvaro Herrera
Excerpts from David E. Wheeler's message of mar oct 02 16:37:30 -0300 2012: On Oct 2, 2012, at 12:30 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: How about call this for precedent: mkdir -p /tmp/foo/bar mkdir -p /tmp/foo/baz In this case you end up with directory foo and at

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread David E. Wheeler
On Oct 2, 2012, at 12:48 PM, Tom Lane t...@sss.pgh.pa.us wrote: I think we should just disallow putting any contained objects in the statement when IF NOT EXISTS is used. It's simple to understand, simple to document and implement, and I think it covers all the sane use-cases anyway. +1

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Andrew Dunstan
On 10/02/2012 03:48 PM, Tom Lane wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: Excerpts from David E. Wheeler's message of mar oct 02 16:16:37 -0300 2012: On Oct 2, 2012, at 12:08 PM, Alvaro Herrera alvhe...@2ndquadrant.com wrote: create schema if not exists foo create table first

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Alvaro Herrera
Excerpts from Andrew Dunstan's message of mar oct 02 17:24:38 -0300 2012: On 10/02/2012 03:48 PM, Tom Lane wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: Well, if that's the rationale then you end up with no schema foo at all (i.e. both die), which seems even more surprising

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Fabrízio de Royes Mello
2012/10/2 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Andrew Dunstan's message of mar oct 02 17:24:38 -0300 2012: On 10/02/2012 03:48 PM, Tom Lane wrote: Alvaro Herrera alvhe...@2ndquadrant.com writes: Well, if that's the rationale then you end up with no schema foo at all

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-10-02 Thread Stirling Newberry
This case points to a weakness in many programming languages, not having a clear ifof (if and only if) versus if construction. The sane use case for create schema foo if not exists object is for building a database dynamically, where several points may be the first to put a table in a schema,

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-09-29 Thread Volker Grabsch
Dickson S. Guedes schrieb: - https://commitfest.postgresql.org/action/patch_view?id=907 The patch is small and implements a new syntax to CREATE SCHEMA that allow the creation of a schema be skipped when IF NOT EXISTS is used. [...] - Should this patch implements others INEs like ADD

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-09-21 Thread David E. Wheeler
On Sep 21, 2012, at 10:59 AM, Tom Lane t...@sss.pgh.pa.us wrote: I don't believe this has been thought through nearly carefully enough. If CREATE SCHEMA created a schema and nothing more, then the proposed implementation would probably be fine. But per spec, CREATE SCHEMA can specify not

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-09-21 Thread Tom Lane
Dickson S. Guedes lis...@guedesoft.net writes: I reviewed this v5 of patch: - https://commitfest.postgresql.org/action/patch_view?id=907 The patch is small and implements a new syntax to CREATE SCHEMA that allow the creation of a schema be skipped when IF NOT EXISTS is used. I don't

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-09-21 Thread Michael Paquier
On Sat, Sep 22, 2012 at 3:06 AM, David E. Wheeler da...@justatheory.comwrote: On Sep 21, 2012, at 10:59 AM, Tom Lane t...@sss.pgh.pa.us wrote: I don't believe this has been thought through nearly carefully enough. If CREATE SCHEMA created a schema and nothing more, then the proposed

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-09-21 Thread Fabrízio de Royes Mello
2012/9/21 David E. Wheeler da...@justatheory.com On Sep 21, 2012, at 10:59 AM, Tom Lane t...@sss.pgh.pa.us wrote: I don't believe this has been thought through nearly carefully enough. If CREATE SCHEMA created a schema and nothing more, then the proposed implementation would probably be

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-28 Thread Fabrízio de Royes Mello
2012/8/27 Dickson S. Guedes lis...@guedesoft.net [...] Two questions: - Should this patch implements others INEs like ADD COLUMN IF NOT EXISTS? If this feature is important I believe we must implement it. Exists several CREATE statements without IF NOT EXISTS option too, so we can

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-28 Thread David E. Wheeler
On Aug 28, 2012, at 8:19 AM, Fabrízio de Royes Mello wrote: - Should this patch implements others INEs like ADD COLUMN IF NOT EXISTS? If this feature is important I believe we must implement it. Exists several CREATE statements without IF NOT EXISTS option too, so we can discuss more

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-28 Thread Dickson S. Guedes
2012/8/28 David E. Wheeler da...@justatheory.com: On Aug 28, 2012, at 8:19 AM, Fabrízio de Royes Mello wrote: - Should this patch implements others INEs like ADD COLUMN IF NOT EXISTS? If this feature is important I believe we must implement it. Exists several CREATE statements without IF

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-27 Thread Dickson S. Guedes
Hello, I reviewed this v5 of patch: - https://commitfest.postgresql.org/action/patch_view?id=907 The patch is small and implements a new syntax to CREATE SCHEMA that allow the creation of a schema be skipped when IF NOT EXISTS is used. It was applied to 483c2c1071c45e275782d33d646c3018f02f9f94

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-17 Thread Fabrízio de Royes Mello
2012/8/16 Dickson S. Guedes lis...@guedesoft.net 2012/8/16 Fabrízio de Royes Mello fabriziome...@gmail.com: The attached patch implement this feature: CREATE SCHEMA [ IF NOT EXISTS ] schema_name [ AUTHORIZATION user_name ] [ schema_element [ ... ] ] CREATE SCHEMA [ IF NOT EXISTS ]

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-17 Thread Fabrízio de Royes Mello
2012/8/17 Fabrízio de Royes Mello fabriziome...@gmail.com I started testing this, but I didn't see regression tests for it. Could you write them?. The attached patch contains regression tests for it. Please, don't consider de last patch (v2) because I make a little mistake on

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-17 Thread Alvaro Herrera
Excerpts from Fabrízio de Royes Mello's message of vie ago 17 09:16:30 -0400 2012: The attached patch contains regression tests for it. I think you're missing support in copyfuncs.c and equalfuncs.c for the new field in the node. -- Álvaro Herrerahttp://www.2ndQuadrant.com/

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-17 Thread Fabrízio de Royes Mello
2012/8/17 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Fabrízio de Royes Mello's message of vie ago 17 09:16:30 -0400 2012: The attached patch contains regression tests for it. I think you're missing support in copyfuncs.c and equalfuncs.c for the new field in the node. You're

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-17 Thread Dickson S. Guedes
2012/8/17 Fabrízio de Royes Mello fabriziome...@gmail.com: 2012/8/17 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Fabrízio de Royes Mello's message of vie ago 17 09:16:30 -0400 2012: The attached patch contains regression tests for it. I think you're missing support in

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-17 Thread Fabrízio de Royes Mello
2012/8/17 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Dickson S. Guedes's message of vie ago 17 10:37:25 -0400 2012: 2012/8/17 Fabrízio de Royes Mello fabriziome...@gmail.com: 2012/8/17 Alvaro Herrera alvhe...@2ndquadrant.com Excerpts from Fabrízio de Royes Mello's

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-16 Thread Fabrízio de Royes Mello
2012/8/15 David E. Wheeler da...@justatheory.com On Aug 15, 2012, at 11:31 AM, Fabrízio de Royes Mello wrote: Is there any reason not to add $subject? Would it be difficult? Looking to the source code I think this feature isn't hard to implement... I'm writing a little path to do that

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-16 Thread Andrew Dunstan
On 08/16/2012 01:36 PM, Fabrízio de Royes Mello wrote: 2012/8/15 David E. Wheeler da...@justatheory.com mailto:da...@justatheory.com On Aug 15, 2012, at 11:31 AM, Fabrízio de Royes Mello wrote: Is there any reason not to add $subject? Would it be difficult? Looking to

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-16 Thread David E. Wheeler
On Aug 16, 2012, at 10:36 AM, Fabrízio de Royes Mello wrote: The attached patch implement this feature: CREATE SCHEMA [ IF NOT EXISTS ] schema_name [ AUTHORIZATION user_name ] [ schema_element [ ... ] ] CREATE SCHEMA [ IF NOT EXISTS ] AUTHORIZATION user_name [ schema_element [ ... ] ]

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-16 Thread Fabrízio de Royes Mello
2012/8/16 David E. Wheeler da...@justatheory.com On Aug 16, 2012, at 10:36 AM, Fabrízio de Royes Mello wrote: The attached patch implement this feature: CREATE SCHEMA [ IF NOT EXISTS ] schema_name [ AUTHORIZATION user_name ] [ schema_element [ ... ] ] CREATE SCHEMA [ IF NOT EXISTS ]

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-16 Thread Dickson S. Guedes
2012/8/16 Fabrízio de Royes Mello fabriziome...@gmail.com: The attached patch implement this feature: CREATE SCHEMA [ IF NOT EXISTS ] schema_name [ AUTHORIZATION user_name ] [ schema_element [ ... ] ] CREATE SCHEMA [ IF NOT EXISTS ] AUTHORIZATION user_name [ schema_element [ ... ] ] Now,

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-15 Thread Fabrízio de Royes Mello
2012/8/15 David E. Wheeler da...@justatheory.com Hackers, Is there any reason not to add $subject? Would it be difficult? Looking to the source code I think this feature isn't hard to implement... I'm writing a little path to do that and I'll send soon... Would save me having to write a

Re: [HACKERS] CREATE SCHEMA IF NOT EXISTS

2012-08-15 Thread David E. Wheeler
On Aug 15, 2012, at 11:31 AM, Fabrízio de Royes Mello wrote: Is there any reason not to add $subject? Would it be difficult? Looking to the source code I think this feature isn't hard to implement... I'm writing a little path to do that and I'll send soon... Cool, thanks! David --