Re: [GENERAL] clone_schema function

2015-09-11 Thread Melvin Davidson
Alvaro, no I haven't updated the wiki (or git). To be honest, I'm retired and I just don't want to bother learning something new, but I do enjoy helping othersfrom time to time. I would consider it a favor if you would do the update for me. TIA, Melvin On Fri, Sep 11, 2015 at 12:30 PM, Alvaro

Re: [GENERAL] clone_schema function

2015-09-11 Thread Melvin Davidson
Thank you very much Alvaro. Now I can go back to being Chief Engineer of Sleeping Late @ retired. :) On Fri, Sep 11, 2015 at 2:21 PM, Alvaro Herrera wrote: > Melvin Davidson wrote: > > Alvaro, > > > > no I haven't updated the wiki (or git). To be honest, I'm retired

Re: [GENERAL] clone_schema function

2015-09-11 Thread Alvaro Herrera
Melvin Davidson wrote: > Here is one more tweak of clone_schema. Are you updating the wiki to match? If not (why?), I think at the very least you should add a link in the wiki page to this thread. -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL Development, 24x7

Re: [GENERAL] clone_schema function

2015-09-11 Thread Alvaro Herrera
Melvin Davidson wrote: > Alvaro, > > no I haven't updated the wiki (or git). To be honest, I'm retired and I > just don't want to bother learning something new, > but I do enjoy helping othersfrom time to time. I would consider it a favor > if you would do the update for me. I wouldn't want to

Re: [GENERAL] avoid lock conflict between SELECT and TRUNCATE

2015-09-11 Thread Sridhar N Bamandlapally
as there is no option for incremental update/insert on user and renaming will have app query errors I guess 1) creating temporary table (say temp_users) on table users with required data/columns-list and index on column user_id, ...this will be faster as there will be no joins with other

[GENERAL] Forced external sort?

2015-09-11 Thread rolf
I've got a poorly indexed query and was attempting a quick work around in production by increasing work_mem when it was called. EXPLAIN ANALYZE is telling me this: Sort Method: external sort Disk: 1253824kB So I set the work_mem to 2gb, still going to disk. I read Tom's suggestion here

Re: [GENERAL] clone_schema function

2015-09-11 Thread Melvin Davidson
"seriously flawed" is a bit of a stretch. Most sane developers would not have schema names of one letter. They usually name a schema something practical, which totally avoids your nit picky exception. However, if you are that concerned about the "serious flaw", you have the option of using the

Re: [GENERAL] clone_schema function

2015-09-11 Thread Alvaro Herrera
Melvin Davidson wrote: > Thank you very much Alvaro. Now I can go back to being Chief Engineer of > Sleeping Late @ retired. :) What? No! You still have a lot of other Snippet pages to go through to improve ;-) -- Álvaro Herrerahttp://www.2ndQuadrant.com/ PostgreSQL

Re: [GENERAL] clone_schema function

2015-09-11 Thread Daniel Verite
Melvin Davidson wrote: > I've added error checking and verified that it now copies the > current sequnce values, table data, views and functions. The code dealing with functions is seriously flawed. Consider that part: SELECT pg_get_functiondef(func_oid) INTO qry; SELECT

Re: [GENERAL] clone_schema function

2015-09-11 Thread Melvin Davidson
Igor & David, You are correct, I am subject to criticism, However, I have spent a few days getting this to work as it should and it now does. Even though the chance of a collision is not zero, it is still low and the function does work. I don't mind criticism, but when someone finds a problem,

Re: [GENERAL] clone_schema function

2015-09-11 Thread David G. Johnston
On Fri, Sep 11, 2015 at 4:23 PM, Melvin Davidson wrote: > "seriously flawed" is a bit of a stretch. Most sane developers would not > have schema names of one letter. > They usually name a schema something practical, which totally avoids your > nit picky exception. >

Re: [GENERAL] clone_schema function

2015-09-11 Thread Igor Neyman
From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Melvin Davidson Sent: Friday, September 11, 2015 4:24 PM To: Daniel Verite Cc: pgsql-general@postgresql.org Subject: Re: [GENERAL] clone_schema function "seriously

[GENERAL] BDR problem

2015-09-11 Thread Charles Lynch
So for about a month now, we've been getting things prepared to use a BDR cluster in a production, multi-region setup on aws. Our initial testing produced some absolutely fantastic results with replication delays less than 150ms between singapore, ireland, and north virginia and this is will SSL

[GENERAL] Domains, check_violation and undefined column field in error

2015-09-11 Thread Andri Möll
Hey, I'm giving DOMAINs a shot and created a simple one with a CHECK on PostgreSQL 9.4.4. Sadly, when the check fails, the thrown error (23514, check_violation) doesn't seem to contain the column information in the "c" field. Should it? Is it just not implemented?

Re: [GENERAL] Domains, check_violation and undefined column field in error

2015-09-11 Thread David G. Johnston
On Friday, September 11, 2015, Andri Möll wrote: > Hey, > > I'm giving DOMAINs a shot and created a simple one with a CHECK on > PostgreSQL 9.4.4. Sadly, when the check fails, the thrown error (23514, > check_violation) doesn't seem to contain the column information in the "c" >

Re: [GENERAL] clone_schema function

2015-09-11 Thread Melvin Davidson
Here is one more tweak of clone_schema. I've added an include_recs flag. If FALSE, then no records are copied into the tables from the old_schema and all sequences start with the minimum value. If TRUE, then all records are copied and sequences are set tot the last value. On Thu, Sep 10, 2015