Re: [GENERAL] fastest dump/restore

2014-01-27 Thread Vincent Veyron
Le dimanche 26 janvier 2014 à 10:27 -0700, Scott Ribe a écrit :
> Is there an article anywhere which documents everything the current state of 
> the art for the fastest dump/restore? What dump/restore format & options? 
> What things to tweak in the config? I've picked up a few bits here and there 
> along the line, but was just wondering if there's a comprehensive source of 
> current advice.


pg_dump has its documentation :
http://www.postgresql.org/docs/9.3/static/app-pgdump.html

see also 14.4.9. Some Notes About pg_dump in :
http://www.postgresql.org/docs/9.3/static/populate.html

-- 
Regards, Vincent Veyron 

http://libremen.com/ 
Legal case, contract and insurance claim management software



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


Re: [GENERAL] fastest dump/restore

2014-01-27 Thread Ian Lawrence Barwick
2014-01-27 Vincent Veyron :
> Le dimanche 26 janvier 2014 à 10:27 -0700, Scott Ribe a écrit :
>> Is there an article anywhere which documents everything the current state of 
>> the art for the fastest dump/restore? What dump/restore format & options? 
>> What things to tweak in the config? I've picked up a few bits here and there 
>> along the line, but was just wondering if there's a comprehensive source of 
>> current advice.
>
>
> pg_dump has its documentation :
> http://www.postgresql.org/docs/9.3/static/app-pgdump.html
>
> see also 14.4.9. Some Notes About pg_dump in :
> http://www.postgresql.org/docs/9.3/static/populate.html

The wiki page for the 9.3 release has some notes and links to blog articles
describing the new parallel dump feature for pg_dump:

https://wiki.postgresql.org/wiki/What%27s_new_in_PostgreSQL_9.3#Parallel_pg_dump_for_faster_backups

Regards

Ian Barwick


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


[GENERAL] A Simple web application

2014-01-27 Thread Manoj Soni
Dear All
I am new to this list and postgres


I have configured postgresql on my laptop. I want to make a simple web
application that saves the data in database in table demog, which has three
fields

Name, Age and Sex

I have created the table and fields.


I have Netbeans IDE also installed.
and Tomcat.

Which tutorial, may help me in this regard.

thanks and Regards

-- 
Manoj , India


Re: [GENERAL] A Simple web application

2014-01-27 Thread Raymond O'Donnell
On 27/01/2014 12:11, Manoj Soni wrote:
> Dear All
> I am new to this list and postgres
> 
> 
> I have configured postgresql on my laptop. I want to make a simple web
> application that saves the data in database in table demog, which has
> three fields
> 
> Name, Age and Sex
> 
> I have created the table and fields.
> 
> 
> I have Netbeans IDE also installed.
> and Tomcat.
> 
> Which tutorial, may help me in this regard.

I did a Google search on "tomcat netbeans postgresql tutorial" and
turned up some likely-looking links should work for you too. :-)

Ray.


-- 
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie


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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Andreas Kretschmer
Raymond O'Donnell  wrote:

> On 27/01/2014 12:11, Manoj Soni wrote:
> > 
> > Name, Age and Sex
> > Which tutorial, may help me in this regard.
> 
> I did a Google search on "tomcat netbeans postgresql tutorial" and
> turned up some likely-looking links should work for you too. :-)

Right, and as a hint: dont store the AGE of a person, store the
birthdate instead.


Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.  (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.  N 51.05082°, E 13.56889°


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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Edson Richter

Em 27/01/2014 13:19, Raymond O'Donnell escreveu:

On 27/01/2014 15:16, Edson Richter wrote:

Em 27/01/2014 10:42, Andreas Kretschmer escreveu:

Raymond O'Donnell  wrote:


On 27/01/2014 12:11, Manoj Soni wrote:

Name, Age and Sex
Which tutorial, may help me in this regard.

I did a Google search on "tomcat netbeans postgresql tutorial" and
turned up some likely-looking links should work for you too. :-)

Right, and as a hint: dont store the AGE of a person, store the
birthdate instead.


Andreas

Another hint: don't store "sex" (do/don't do?), but "gender" (even
better if tristate: male/female/not informed or "other").
I already had lots of trouble with customers asking me to adjust my
systems to this new "situation", then I've to change systems and
database...

+1 to this... there was a lengthy thread on this list some years ago on
this very subject, and it was an eye-opener to see the possibilities
that emerged.

Ray.


Yes - indeed, this is so complex, that my current mapping is a 
One-to-many mapping with a aux "gender" table - so each customer would 
add as many options as they want.


Regards,

Edson


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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Adrian Klaver

On 01/27/2014 07:19 AM, Raymond O'Donnell wrote:

On 27/01/2014 15:16, Edson Richter wrote:

Em 27/01/2014 10:42, Andreas Kretschmer escreveu:

Raymond O'Donnell  wrote:


On 27/01/2014 12:11, Manoj Soni wrote:

Name, Age and Sex
Which tutorial, may help me in this regard.

I did a Google search on "tomcat netbeans postgresql tutorial" and
turned up some likely-looking links should work for you too. :-)

Right, and as a hint: dont store the AGE of a person, store the
birthdate instead.


Andreas


Another hint: don't store "sex" (do/don't do?), but "gender" (even
better if tristate: male/female/not informed or "other").
I already had lots of trouble with customers asking me to adjust my
systems to this new "situation", then I've to change systems and
database...


+1 to this... there was a lengthy thread on this list some years ago on
this very subject, and it was an eye-opener to see the possibilities
that emerged.


Agreed, that thread had me diving back into my biology textbooks. Turns 
out they only partially covered the topic.




Ray.





--
Adrian Klaver
adrian.kla...@gmail.com


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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Raymond O'Donnell
On 27/01/2014 15:16, Edson Richter wrote:
> Em 27/01/2014 10:42, Andreas Kretschmer escreveu:
>> Raymond O'Donnell  wrote:
>>
>>> On 27/01/2014 12:11, Manoj Soni wrote:
 Name, Age and Sex
 Which tutorial, may help me in this regard.
>>> I did a Google search on "tomcat netbeans postgresql tutorial" and
>>> turned up some likely-looking links should work for you too. :-)
>> Right, and as a hint: dont store the AGE of a person, store the
>> birthdate instead.
>>
>>
>> Andreas
> 
> Another hint: don't store "sex" (do/don't do?), but "gender" (even
> better if tristate: male/female/not informed or "other").
> I already had lots of trouble with customers asking me to adjust my
> systems to this new "situation", then I've to change systems and
> database...

+1 to this... there was a lengthy thread on this list some years ago on
this very subject, and it was an eye-opener to see the possibilities
that emerged.

Ray.


-- 
Raymond O'Donnell :: Galway :: Ireland
r...@iol.ie


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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Edson Richter

Em 27/01/2014 10:42, Andreas Kretschmer escreveu:

Raymond O'Donnell  wrote:


On 27/01/2014 12:11, Manoj Soni wrote:

Name, Age and Sex
Which tutorial, may help me in this regard.

I did a Google search on "tomcat netbeans postgresql tutorial" and
turned up some likely-looking links should work for you too. :-)

Right, and as a hint: dont store the AGE of a person, store the
birthdate instead.


Andreas


Another hint: don't store "sex" (do/don't do?), but "gender" (even 
better if tristate: male/female/not informed or "other").
I already had lots of trouble with customers asking me to adjust my 
systems to this new "situation", then I've to change systems and database...


Regards,

Edson Richter



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


[GENERAL] PostgreSQL 9.2.4 using large amount of memory

2014-01-27 Thread Bhushan Pathak
Hello,

We have recently shifted to postgresql version 9.2.4 from 9.1.3. After the
migration, we observed that some of our delete queries on single table
[which have triggers, which in turn call other functions] have started
consuming large amounts of memory.

In 9.1.3, this usage was upto 25MB with the same load on the same server.
With 9.2.4 it has jumped upto ~580 MB. We are monitoring the RES column
from top output to get the memory usage.

Our migration method from 9.1.3 to 9.2.4 was take a dump, un-install 9.1.3,
install 9.2.4 & restore the dump.

I also went through the thread -
http://postgresql.1045698.n5.nabble.com/Memory-usage-after-upgrade-to-9-2-4-td5752733.html

In the thread in the end it is mentioned that there was some data
corruption & points to 9.1.6 release notes. I went through the release
notes & only thing of note that I found was the re-indexing or performing
vacuum operation in case of in-place upgrade, which is not the case for me.

Any help/pointers in debugging would be helpful.

Thanks
Bhushan


Re: [GENERAL] PostgreSQL 9.2.4 using large amount of memory

2014-01-27 Thread Tom Lane
Bhushan Pathak  writes:
> In 9.1.3, this usage was upto 25MB with the same load on the same server.
> With 9.2.4 it has jumped upto ~580 MB. We are monitoring the RES column
> from top output to get the memory usage.

On most versions of "top", examining RES alone gives a completely
misleading impression of what's happening.  RES minus SHR is a better
estimate of what the process has really consumed.  I don't know why the
behavior changed from 9.1 to 9.2, but this measurement alone is not
evidence that you have an actual problem.

regards, tom lane


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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Steve Crawford

On 01/27/2014 07:19 AM, Raymond O'Donnell wrote:

On 27/01/2014 15:16, Edson Richter wrote:

Em 27/01/2014 10:42, Andreas Kretschmer escreveu:

Raymond O'Donnell  wrote:


On 27/01/2014 12:11, Manoj Soni wrote:

Name, Age and Sex
Which tutorial, may help me in this regard.

I did a Google search on "tomcat netbeans postgresql tutorial" and
turned up some likely-looking links should work for you too. :-)

Right, and as a hint: dont store the AGE of a person, store the
birthdate instead.


Andreas

Another hint: don't store "sex" (do/don't do?), but "gender" (even
better if tristate: male/female/not informed or "other").
I already had lots of trouble with customers asking me to adjust my
systems to this new "situation", then I've to change systems and
database...

+1 to this... there was a lengthy thread on this list some years ago on
this very subject, and it was an eye-opener to see the possibilities
that emerged.

Ray.



Actually, to be pedantic, use whichever is appropriate to your use-case.

If you are looking at biological/physiological attributes (chromosomes, 
hormones, testicular-cancer, ...), use "sex."


If you are tracking social attributes or characteristics (preferred 
dress-style, sexual-preference, income, prevalence in various 
professional roles, etc.), use "gender."


See http://www.who.int/gender/whatisgender/en/

Either way, an expandable lookup-table may end up being useful. Just 
when you think you are strictly dealing with "sex" and you hard-code for 
"male" and "female", someone will show up and ask you to rewrite your 
code to account for chimeras 
(http://en.wikipedia.org/wiki/Chimera_%28genetics%29).


Cheers,
Steve



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


Re: [GENERAL] A Simple web application

2014-01-27 Thread Adrian Klaver

On 01/27/2014 09:30 AM, Steve Crawford wrote:

On 01/27/2014 07:19 AM, Raymond O'Donnell wrote:

On 27/01/2014 15:16, Edson Richter wrote:

Em 27/01/2014 10:42, Andreas Kretschmer escreveu:

Raymond O'Donnell  wrote:


On 27/01/2014 12:11, Manoj Soni wrote:

Name, Age and Sex
Which tutorial, may help me in this regard.

I did a Google search on "tomcat netbeans postgresql tutorial" and
turned up some likely-looking links should work for you too. :-)

Right, and as a hint: dont store the AGE of a person, store the
birthdate instead.


Andreas

Another hint: don't store "sex" (do/don't do?), but "gender" (even
better if tristate: male/female/not informed or "other").
I already had lots of trouble with customers asking me to adjust my
systems to this new "situation", then I've to change systems and
database...

+1 to this... there was a lengthy thread on this list some years ago on
this very subject, and it was an eye-opener to see the possibilities
that emerged.

Ray.



Actually, to be pedantic, use whichever is appropriate to your use-case.

If you are looking at biological/physiological attributes (chromosomes,
hormones, testicular-cancer, ...), use "sex."

If you are tracking social attributes or characteristics (preferred
dress-style, sexual-preference, income, prevalence in various
professional roles, etc.), use "gender."

See http://www.who.int/gender/whatisgender/en/

Either way, an expandable lookup-table may end up being useful. Just
when you think you are strictly dealing with "sex" and you hard-code for
"male" and "female", someone will show up and ask you to rewrite your
code to account for chimeras
(http://en.wikipedia.org/wiki/Chimera_%28genetics%29).



Which actually seems not to be fairly normal :

http://www.nytimes.com/2014/01/21/science/seeing-x-chromosomes-in-a-new-light.html?_r=0





Cheers,
Steve






--
Adrian Klaver
adrian.kla...@gmail.com


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


Re: [GENERAL] any examples - sync offline json to server

2014-01-27 Thread Merlin Moncure
On Sat, Jan 25, 2014 at 10:44 PM, john.tiger  wrote:
> scenario:  download key data in json format to mobile - then use offline (ie
> in areas where no wifi available) - then when back in wifi range, sync with
> db server
>
> this is what pouch, couch offers but would like to do with postgresql if
> possible

You just described an 'application that loads and saves things'.  The
fact that you're using json for transmission is only somewhat
meaningful.  The hard part is going to reconciling the data state with
the database.

merlin


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


[GENERAL] problem with grant all privileges

2014-01-27 Thread Susan Cassidy
I tried:

GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO testuser;
and I get:
ERROR:  syntax error at or near "ALL"
LINE 1: GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO te...


also the same thing for tables, with the same results.

Am I misinterpreting the syntax for this?

Susan


Re: [GENERAL] problem with grant all privileges

2014-01-27 Thread Adrian Klaver

On 01/27/2014 01:45 PM, Susan Cassidy wrote:

I tried:

GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO testuser;
and I get:
ERROR:  syntax error at or near "ALL"
LINE 1: GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO te...


also the same thing for tables, with the same results.

Am I misinterpreting the syntax for this?


Depends on what version of Postgres you are working with. The syntax of 
commands changes with time.


So what Postgres version are you using?



Susan



--
Adrian Klaver
adrian.kla...@gmail.com


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


Re: [GENERAL] pg_dump: dumpBlobs(): could not open large object: ERROR: large object 27729547 does not exist

2014-01-27 Thread Kevin Grittner
Alban Hertroys  wrote:

> That raises an interesting question: How far back will support
> for older versions in pg_dump go?

http://www.postgresql.org/docs/current/interactive/app-pgdump.html#PG-DUMP-NOTES

says:

| pg_dump can also dump from PostgreSQL servers older than its own
| version. (Currently, servers back to version 7.0 are supported.)

--
Kevin Grittner
EDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


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


Re: [GENERAL] pg_dump: dumpBlobs(): could not open large object: ERROR: large object 27729547 does not exist

2014-01-27 Thread Tom Lane
Kevin Grittner  writes:
> Alban Hertroys  wrote:
>> That raises an interesting question: How far back will support
>> for older versions in pg_dump go?

> http://www.postgresql.org/docs/current/interactive/app-pgdump.html#PG-DUMP-NOTES
> says:

> | pg_dump can also dump from PostgreSQL servers older than its own
> | version. (Currently, servers back to version 7.0 are supported.)

There's been talk of dropping pg_dump's support for dumping from pre-7.3
servers, as that would allow removing quite a lot of crufty and no longer
well-tested code.  (7.3 is an interesting cutoff because that release
introduced both schema support and pg_depend dependency tracking.)

Not sure when we will get around to that, but it seems likely to happen at
some point.

regards, tom lane


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


Re: [GENERAL] problem with grant all privileges

2014-01-27 Thread Tom Lane
Adrian Klaver  writes:
> On 01/27/2014 01:45 PM, Susan Cassidy wrote:
>> I tried:
>> GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO testuser;
>> and I get:
>> ERROR:  syntax error at or near "ALL"
>> Am I misinterpreting the syntax for this?

> Depends on what version of Postgres you are working with. The syntax of 
> commands changes with time.

That syntax works for me back to 9.0, but 8.4 gives the described error;
which is unsurprising when you examine the respective documentation.

regards, tom lane


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


Re: [GENERAL] problem with grant all privileges

2014-01-27 Thread Susan Cassidy
This is 9.2



On Mon, Jan 27, 2014 at 4:16 PM, Tom Lane  wrote:

> Adrian Klaver  writes:
> > On 01/27/2014 01:45 PM, Susan Cassidy wrote:
> >> I tried:
> >> GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO testuser;
> >> and I get:
> >> ERROR:  syntax error at or near "ALL"
> >> Am I misinterpreting the syntax for this?
>
> > Depends on what version of Postgres you are working with. The syntax of
> > commands changes with time.
>
> That syntax works for me back to 9.0, but 8.4 gives the described error;
> which is unsurprising when you examine the respective documentation.
>
> regards, tom lane
>


Re: [GENERAL] problem with grant all privileges

2014-01-27 Thread Tom Lane
Susan Cassidy  writes:
> This is 9.2

I'd bet a very good dinner that it isn't --- maybe your psql is,
but your server has to be pre-9.0.  Try "select version();" to
see the actual version of the server you're connected to.

regards, tom lane


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


[GENERAL] Composite type

2014-01-27 Thread antono124
Hello guys!

I have found a example in Oracle and I am trying to do it in Postgre. 

Lets say that we have 2 tables.  
Create Table "table1" Of "type1"
Create Table "table2" Of "type2"

I want to refer the first table in the second. I want to reference the whole
table not only one field, so something like that:

CREATE TYPE type2 AS OBJECT (
  var1   NUMBER,
  var2REF type1
  )

CREATE TABLE table2 OF type2 (  
   PRIMARY KEY (Pk),   
   FOREIGN KEY (fk) REFERENCES table1) 

Can i do something like this in Postgre?

Thank you in advance!
George Ant






--
View this message in context: 
http://postgresql.1045698.n5.nabble.com/Composite-type-tp5788860.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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


Re: [GENERAL] postgres-fdw questions

2014-01-27 Thread Emmanuel Medernach

On 01/24/2014 04:58 PM, Jim Mlodgenski wrote:




On Fri, Jan 24, 2014 at 4:20 AM, Emmanuel Medernach mailto:meder...@clermont.in2p3.fr>> wrote:

Hello,

I'm currently testing postgres_fdw feature on PostgreSQL 9.3.2 and I have
some questions:

  - What are the limits to the number of foreign tables ?
  - What is the current status about foreign joins push-down ?


The Custom Scan API patch adds the ability to push down joins to foreign tables,
but its still pending
https://commitfest.postgresql.org/action/patch_view?id=1282



Very interesting, keep up the good work.

Thanks for all your replies.
--
<>
-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


Re: [GENERAL] Fully-automatic streaming replication failover when master dies?

2014-01-27 Thread Dmitry Koterov
Complex in its implementation - maybe. Complex in its configuration and
ideology - nope.

> Are you running your cluster in synchronous mode across geographically diverse
data centers?
Config option #1 ("allow replicas to re-bind to the second synchronous
master if the first one fails, and allow the second master to run
separately").

> How long do you wait for the master to come back before you fail over?
Config option #2 ("how many missed heartbeats cause the automatic failover
process").

There could be more options, of course. But all this is not a rocket
science, it's just not yet implemented, I suppose. I thought your point was
"The difference is that in MongoDB automatic failover is simple, in
PostgreSQL it is much more complex" - I don't agree with that, I think the
tasks have more or less same complexity. There could be no "silver bullet"
with no data loss for PostgreSQL and MongoDB both (though both PostgreSQL
and MongoDB support synchronous multi-node commits: PostgreSQL supports
synchronous multi-master, MongoDB supports write concern, but this causes a
performance penalty). I just mentioned MongoDB, because it has an excellent
automatic failover mechanism, which originates not from its noSQLness and
could be theoretically implemented in any other databases (including
PostgreSQL), not for a holy war.



On Sun, Jan 26, 2014 at 8:50 AM, Scott Marlowe wrote:

> Please don't top post in technical discussions.
>
> On Sat, Jan 25, 2014 at 11:29 AM, Dmitry Koterov
>  wrote:
> >
> > On Friday, January 24, 2014, Scott Marlowe 
> wrote:
> >>
> >> On Thu, Jan 23, 2014 at 7:16 PM, Sameer Kumar 
> >> wrote:
> >> >
> >> >
> >> > On Fri, Jan 24, 2014 at 1:38 AM, Susan Cassidy
> >> >  wrote:
> >> >>
> >> >> pgpool-II may do what you want.  Lots of people use it.
> >> >
> >> >
> >> > I don't think pgpool adds the lost node on its own (once the node is
> >> > live or available again). Plus if you have a 3 node replication you
> need to
> >> > have your own failover_command (as a shell script) which changes the
> master
> >> > node for 2nd secondary when one of the secondary servers decides to be
> >> > promoted to primary). I hope things will get easy with version 9.4 (I
> guess
> >> > in 9.4 one won't have to rebuild a master node from backup. if the
> wal files
> >> > are available it will just roll forward).
> >> >
> >> >> > for all the machines). At least MongoDB does the work well, and
> with
> >> >> > almost
> >> >> > zero configuration.
> >> >> Mongo's data guarantees are, um, somewhat less robust than
> >> >> PostgreSQL's.
> >> >
> >> >
> >> > I don't think this has anything to do with data reliability or ACID
> >> > property (if that is what you are referring to).
> >> >
> >> >>  Failover is easy if you don't have to be exactly right.
> >> >
> >> >
> >> > IMHO That's not a fair point. PostgreSQL supports sync replication (as
> >> > well as async) and does that complicate the failover process or an
> async
> >> > replication? I guess what he is asking for is automation of whatever
> feature
> >> > PostgreSQL already supports.
> >>
> >> No it's a fair point. When you go from "we promise to try and not lose
> >> your data" to "we promise to not lose any of your data" the situation
> >> is much different.
> >>
> >> There are many things to consider in the postgresql situation. Is it
> >> more important to keep your application up and running, even if only
> >> in read only mode? Is performance more important than data integrity?
> >> How many nodes do you have? How man can auto-fail over before you
> >> auto-fail over to the very last one? How do you rejoin failed nodes,
> >> one at a time, all at once, by hand, automagically? And so on. There
> >> are a LOT of questions to ask that mongo already decided for you, and
> >> the decision was that if you lose some data that's OK as long as the
> >> cluster stays up. With PostgreSQL the decision making process probably
> >> has a big impact on how you answer these types of questions and how
> >> you fail over.
> >>
> >> Add to that that most postgresql database servers are VERY robust,
> >> with multi-lane RAID array controllers and / or sturdy SANs underneath
> >> them, and their failure rates are very low, you run the risk of your
> >> auto-failover causing much of an outage as the server failing, since
> >> most failovers are going to cause some short interruption in service.
> >> It's not a simple push a button take a banana, one size fits all
> >> problem and solution.
>
> > Failover is NOT about the RAID or SAN robusness mostly. It's about
> > datacenters connectivity and network issues. If you lose one datacenter
> (it
> > happens, and there is no aid for it), you should redirect all traffic to
> > another DC ASAP and failover the master DB to it. When the disconnected
> DC
> > is up again, it should recover from this situation.
> >
> > So +1 for the previous man, PostgreSQL ACID and MongoDB non-ACID have
> > absolute no relevance to the failover problem

Re: [GENERAL] Composite type

2014-01-27 Thread Michael Paquier
On Mon, Jan 27, 2014 at 2:02 AM, antono124  wrote:
> Lets say that we have 2 tables.
> Create Table "table1" Of "type1"
> Create Table "table2" Of "type2"
>
> I want to refer the first table in the second. I want to reference the whole
> table not only one field, so something like that:
>
> CREATE TYPE type2 AS OBJECT (
>   var1   NUMBER,
>   var2REF type1
>   )
>
> CREATE TABLE table2 OF type2 (
>PRIMARY KEY (Pk),
>FOREIGN KEY (fk) REFERENCES table1)
>
> Can i do something like this in Postgre?
It is possible to use multiple column names with defining a foreign key:
=# create table t1 (a int, b text, primary key (a, b));
CREATE TABLE
=# create table t2 (a int, b text, c text, foreign key (a, b)
references t1 (a, b));
CREATE TABLE
=# \d t2
  Table "public.t2"
 Column |  Type   | Modifiers
+-+---
 a  | integer |
 b  | text|
 c  | text|
Foreign-key constraints:
"t2_a_fkey" FOREIGN KEY (a, b) REFERENCES t1(a, b)

You could as well use some custom types if you do not want to
reference all the columns...
=# create type ty1 as (a int, b int);
CREATE TYPE
=# create table t1 (c ty1 primary key);
CREATE TABLE
=# create table t2 (d int primary key, e ty1 references t1 (c));
CREATE TABLE
=# \d t2
  Table "public.t2"
 Column |  Type   | Modifiers
+-+---
 d  | integer | not null
 e  | ty1 |
Indexes:
"t2_pkey" PRIMARY KEY, btree (d)
Foreign-key constraints:
"t2_e_fkey" FOREIGN KEY (e) REFERENCES t1(c)

Regards,
-- 
Michael


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


[GENERAL] plsql / plpgsql code coverage tool, static analysis tool

2014-01-27 Thread ning chan
Hi PG Community,

Does anyone know any code coverage tool and static analysis tool for PL/SQL
or PL/pgSQL code?

Thanks~
Ning


Re: [GENERAL] Composite type

2014-01-27 Thread John R Pierce

On 1/26/2014 9:02 AM, antono124 wrote:

I want to refer the first table in the second. I want to reference the whole
table not only one field, so something like that:


does this table1 have a primary key?  if so, referencing the PK allows 
you to fetch the whole row via a join.   if this table doesn't have a 
primary key, um, why not??




--
john r pierce  37N 122W
somewhere on the middle of the left coast



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


Re: [GENERAL] Fully-automatic streaming replication failover when master dies?

2014-01-27 Thread John R Pierce

On 1/26/2014 12:35 AM, Dmitry Koterov wrote:

PostgreSQL supports synchronous multi-master


no, PostgreSQL does not support multi-master, not without some sort of 
third party replication system, all of which have serious compromises.




--
john r pierce  37N 122W
somewhere on the middle of the left coast