Re: [GENERAL] Turn off streaming replication - leaving Master running

2015-06-28 Thread Michael Paquier
On Mon, Jun 29, 2015 at 3:34 PM, Andy Erskine wrote: > no snapshot available .. i don't mind running basebackup once i've > finished my test. > > So if someone could help with the steps to turn off replication and bring > secondary up as a standalone db that would be great. > How to promote a no

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread Jeff Janes
On Sun, Jun 28, 2015 at 10:31 PM, Shujie Shang wrote: > Oh, I didn't explain my question well, actually I want to create an index > on an udt in a table. > > e.g. > create type info as (id int, name text); > creat table test (i info); > I want to run: > create index myindex on test (i.id) > > > I

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread John R Pierce
On 6/28/2015 11:24 PM, Shujie Shang wrote: insert into test values (generate_series(1, 300), (1, 'hi')::info); explain select * from test where i.id =1; the result is : seqscan does not every row of that match i.id = 1 ? try ... insert into test values (generate_series(1,

Re: [GENERAL] Turn off streaming replication - leaving Master running

2015-06-28 Thread Andy Erskine
no snapshot available .. i don't mind running basebackup once i've finished my test. So if someone could help with the steps to turn off replication and bring secondary up as a standalone db that would be great thanks. On 29 June 2015 at 15:58, John R Pierce wrote: > On 6/28/2015 10:52 PM, Mich

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread Shujie Shang
Hi, I find a way to create index, I create a function returns the 'id' field of udt info, then I create index based on this function. e.g create type info as (id int, name text); creat table test (id int, i info); create or replace function getID(i info) returns int as $$ select $1.id $$ languag

Re: [GENERAL] Turn off streaming replication - leaving Master running

2015-06-28 Thread Andy Erskine
Cheers Micheal, So i don't want to touch the file as this will promote it too a master - i would just like it as a standalone db for this instance - i need to load a db and do some testing. After which i will delete the data directory and run the basebackup cmd and pull the db back from the maste

Re: [GENERAL] Turn off streaming replication - leaving Master running

2015-06-28 Thread John R Pierce
On 6/28/2015 10:52 PM, Michael Paquier wrote: Well, yes. It depends on what you want to do then. If this testing really requires to promote the standby then you will need to take a new fresh base backup knowing that you are using 9.2. if the standby is running on a file system with snapshotting

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread Charles Clavadetscher
Hello I am not sure it is that simple. Probably you need to create operator classes to be used for indexing. http://www.postgresql.org/docs/9.4/static/xtypes.html You are probably better off using the basic data type in your table and using a composite index. Bye Charles F

Re: [GENERAL] Turn off streaming replication - leaving Master running

2015-06-28 Thread Michael Paquier
On Mon, Jun 29, 2015 at 2:42 PM, Andy Erskine wrote: > I'd like to turn off the streaming on my postgresdb (9.2) It is currently > setup to stream from master to a single secondary. > > I want to shutdown the secondary and turn it into another master and connect > it to another application for tes

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread John R Pierce
On 6/28/2015 10:31 PM, Shujie Shang wrote: Oh, I didn't explain my question well, actually I want to create an index on an udt in a table. e.g. create type info as (id int, name text); creat table test (i info); I want to run: create index myindex on test (i.id ) create table

[GENERAL] Turn off streaming replication - leaving Master running

2015-06-28 Thread Andy Erskine
I'd like to turn off the streaming on my postgresdb (9.2) It is currently setup to stream from master to a single secondary. I want to shutdown the secondary and turn it into another master and connect it to another application for testing - after which i want to revert it back to a streaming seco

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread Shujie Shang
Oh, I didn't explain my question well, actually I want to create an index on an udt in a table. e.g. create type info as (id int, name text); creat table test (i info); I want to run: create index myindex on test (i.id) On Mon, Jun 29, 2015 at 1:23 PM, John R Pierce wrote: > On 6/28/2015 10:0

Re: [GENERAL] create index on a field of udt

2015-06-28 Thread John R Pierce
On 6/28/2015 10:08 PM, Shujie Shang wrote: create type info as (id int, name text); I want to create index on info.id . you can't create an index on a type, just on a table. create table info (id serial primary key, name text); or create table info (id serial, name t

[GENERAL] create index on a field of udt

2015-06-28 Thread Shujie Shang
Hi, All: I want to create a index on one field of udt, how can I do that? e.g create type info as (id int, name text); I want to create index on info.id. Thanks

Re: [GENERAL] Inserting from multiple processes?

2015-06-28 Thread Dave Johansen
On Sat, Jun 27, 2015 at 11:00 AM, Francisco Olarte wrote: > Hi Dave: > > On Fri, Jun 26, 2015 at 2:59 AM, Dave Johansen > wrote: > > > It appears that calling "SELECT insert_test_no_dup('2015-01-01', 1, 1)" > > cause the XID to increment? I'm not sure if it's only when the exception > > happens

Re: [GENERAL] Weird insert issue

2015-06-28 Thread Larry Meadors
Thanks for the clarification guys! That was not the behavior I was expecting (as you can tell), so I learned something new today. :) In my case I don't want an update (there are only the 2 fields, so it's just insert or delete), so I'll fire the insert as it is (that'll get the cases where it's no