Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread Pavel Stehule
2012/5/30 yi huang : > On Wed, May 30, 2012 at 11:21 AM, Pavel Stehule > wrote: >> >> Hello >> >> create or replace function call_foo() >> returns void as $$ >> declare r record; >> begin >>  r := foo('Hello'); >>  raise notice ''% %', r.somerow, r.otherinfo; >> end; >> $$ language plpgsql; > > >

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
On Wed, May 30, 2012 at 11:21 AM, Pavel Stehule wrote: > Hello > > create or replace function call_foo() > returns void as $$ > declare r record; > begin > r := foo('Hello'); > raise notice ''% %', r.somerow, r.otherinfo; > end; > $$ language plpgsql; > It turns out i also need to define a type

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
On Wed, May 30, 2012 at 12:36 PM, yi huang wrote: > Thanks for you quick reply, but i need to take this returned row in > another pgsql function and do further processing. Sorry, i was misunderstood, i get it now, just use a record type, thanks very much. > > > On Wed, May 30, 2012 at 11:21 A

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
Thanks for you quick reply, but i need to take this returned row in another pgsql function and do further processing. On Wed, May 30, 2012 at 11:21 AM, Pavel Stehule wrote: > Hello > > create or replace function call_foo() > returns void as $$ > declare r record; > begin > r := foo('Hello'); >

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Craig Ringer
On 05/30/2012 10:01 AM, Adrian Klaver wrote: On 05/29/2012 06:56 PM, Craig Ringer wrote: On 05/29/2012 02:27 AM, Alexander Reichstadt wrote: Hi, I am trying to "simply" export my postgres database from one server and then import it into another. I thought I could use PhpPgAdmin, but the hint

Re: [GENERAL] How to handle nested record data.

2012-05-29 Thread Pavel Stehule
Hello create or replace function call_foo() returns void as $$ declare r record; begin r := foo('Hello'); raise notice ''% %', r.somerow, r.otherinfo; end; $$ language plpgsql; regards Pavel 2012/5/30 yi huang : > I'm porting a oracle function to postgresql, which has signature like this: >

[GENERAL] How to handle nested record data.

2012-05-29 Thread yi huang
I'm porting a oracle function to postgresql, which has signature like this: FUNCTION foo ( seq IN varchar , somerow OUT SomeTable , otherinfo OUT varchar ) It's easy to port this function itself to postgresql, but i have problem to execute this function and assign the result

Re: [GENERAL] Escaping `psql --variable`

2012-05-29 Thread Alan Gutierrez
On Tue, May 29, 2012 at 05:19:49PM -0700, Jeff Davis wrote: > On Tue, 2012-05-29 at 18:32 -0400, Alan Gutierrez wrote: > > Surprised that this works: > > > > echo ":foo" | psql --variable foo="SELECT 1 AS FOO;" template1 > > > > Why doesn't `psql` escape parameters passed in through `--vari

Re: [GENERAL] timestamps, formatting, and internals

2012-05-29 Thread Adrian Klaver
On 05/29/2012 04:28 PM, David Salisbury wrote: > > > On 5/27/12 12:25 AM, Jasen Betts wrote: >> The query: "show integer_datetimes;" should return 'on' which means >> timestamps are microsecond precision if it returns 'off' your database >> was built with floating point timstamps and equality tes

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Adrian Klaver
On 05/29/2012 06:56 PM, Craig Ringer wrote: On 05/29/2012 02:27 AM, Alexander Reichstadt wrote: Hi, I am trying to "simply" export my postgres database from one server and then import it into another. I thought I could use PhpPgAdmin, but the hints on the web don't seem to work. One said to s

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Craig Ringer
On 05/29/2012 02:27 AM, Alexander Reichstadt wrote: Hi, I am trying to "simply" export my postgres database from one server and then import it into another. I thought I could use PhpPgAdmin, but the hints on the web don't seem to work. One said to simply get a dump from one phpPgAdmin, the go

Re: [GENERAL] Escaping `psql --variable`

2012-05-29 Thread Jeff Davis
On Tue, 2012-05-29 at 18:32 -0400, Alan Gutierrez wrote: > Surprised that this works: > > echo ":foo" | psql --variable foo="SELECT 1 AS FOO;" template1 > > Why doesn't `psql` escape parameters passed in through `--variable`. When I > use > a library in other languages, they will escape th

Re: [GENERAL] Updateable Views or Synonyms.

2012-05-29 Thread Jeff Davis
On Wed, 2012-05-30 at 11:16 +1200, Tim Uckun wrote: > I am wondering if either of these features are on the plate for > postgres anytime soon? I see conversations going back to 2007 on > updateable views and some conversations about synonyms but obviously > they have never been added to the databas

[GENERAL] select current_setting('transaction_isolation')

2012-05-29 Thread David Kerr
Howdy, I recently did a log_min_duration_statement=0 run on my app, and found ~3million copies of "select current_setting('transaction_isolation')" I'm a Java + Hibernate stack. Does anyone know if this is a Hibernate artifact? or a jdbc artifact? or something else (implicit to some query patte

Re: [GENERAL] timestamps, formatting, and internals

2012-05-29 Thread David Salisbury
On 5/27/12 12:25 AM, Jasen Betts wrote: The query: "show integer_datetimes;" should return 'on' which means timestamps are microsecond precision if it returns 'off' your database was built with floating point timstamps and equality tests will be unreliable, I find that rather interesting. I

[GENERAL] Updateable Views or Synonyms.

2012-05-29 Thread Tim Uckun
I am wondering if either of these features are on the plate for postgres anytime soon? I see conversations going back to 2007 on updateable views and some conversations about synonyms but obviously they have never been added to the database for some reason or another. With regards to synonyms. It

[GENERAL] Escaping `psql --variable`

2012-05-29 Thread Alan Gutierrez
Surprised that this works: echo ":foo" | psql --variable foo="SELECT 1 AS FOO;" template1 Why doesn't `psql` escape parameters passed in through `--variable`. When I use a library in other languages, they will escape the variable. How do I use `psql` from `bash` so that it will escape vari

[GENERAL] full text searching

2012-05-29 Thread Mark Phillips
I have read the pg 9.1 doc's about full text search, rambled about the web a bit looking for related articles, and had good experiences implementing lightweight prototypes. Now I can sense the depth of the water as I try to determine a solid approach for implementation. I would be most gratefu

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Fujii Masao
On Wed, May 30, 2012 at 3:04 AM, Raghavendra wrote: >> > Since stopping or restarting the postgres servers would involve complete >> > invalidation of the connection pool [Java/JEE app server pool] that may >> > take >> > a few minutes before the application becomes usable, it would be great >> >

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Fujii Masao
On Wed, May 30, 2012 at 2:38 AM, Michael Nolan wrote: > > > -- Forwarded message -- > From: Michael Nolan > Date: Tue, May 29, 2012 at 1:37 PM > Subject: Re: [GENERAL] Disable Streaming Replication without restarting > either master or slave > To: Fujii Masao > > > > > On Tue, Ma

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Raghavendra
> > > Since stopping or restarting the postgres servers would involve complete > > invalidation of the connection pool [Java/JEE app server pool] that may > take > > a few minutes before the application becomes usable, it would be great if > > there is a way we can disable replication [for maintena

Re: [GENERAL] Interval Division Workaround Suggestions (sub-day intervals only)?

2012-05-29 Thread Chris Angelico
On Wed, May 30, 2012 at 3:50 AM, David Johnston wrote: > Any suggestions on how to obtain the number of “X minute” intervals in “Y” > where “Y” is always less than 24 hours? > > e.g., : ‘05:00:00’::interval / ’00:06:00’::interval => 50 (integer) Turn them into integer seconds: select date_part(

[GENERAL] Interval Division Workaround Suggestions (sub-day intervals only)?

2012-05-29 Thread David Johnston
Any suggestions on how to obtain the number of "X minute" intervals in "Y" where "Y" is always less than 24 hours? e.g., : '05:00:00'::interval / '00:06:00'::interval => 50 (integer) I am guessing because intervals cover not-well-defined (variable) periods of times (i.e., months, years) tha

Fwd: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Michael Nolan
-- Forwarded message -- From: Michael Nolan Date: Tue, May 29, 2012 at 1:37 PM Subject: Re: [GENERAL] Disable Streaming Replication without restarting either master or slave To: Fujii Masao On Tue, May 29, 2012 at 1:15 PM, Fujii Masao wrote: > On Tue, May 29, 2012 at 10:17 P

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Sergey Konoplev
On Tue, May 29, 2012 at 2:18 PM, Samba wrote: > Is it possible stop/disable streaming replication without stopping or > restarting either master or slave servers? > > Since stopping or restarting the postgres servers would involve complete > invalidation of the connection pool [Java/JEE app server

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Fujii Masao
On Tue, May 29, 2012 at 10:17 PM, François Beausoleil wrote: > Hi! > > Le 2012-05-29 à 06:18, Samba a écrit : > > Is it possible stop/disable streaming replication without stopping or > restarting either master or slave servers? > > Since stopping or restarting the postgres servers would involve c

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Fujii Masao
On Tue, May 29, 2012 at 7:18 PM, Samba wrote: > Hi, > > > Is it possible stop/disable streaming replication without stopping or > restarting either master or slave servers? > > Since stopping or restarting the postgres servers would involve complete > invalidation of the connection pool [Java/JEE

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Merlin Moncure
On Mon, May 28, 2012 at 1:27 PM, Alexander Reichstadt wrote: > Hi, > > I am trying to "simply" export my postgres database from one server and then > import it into another. I thought I could use PhpPgAdmin, but the hints on > the web don't seem to work. One said to simply get a dump from one >

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Alban Hertroys
On 29 May 2012 14:58, Adrian Klaver wrote: > Q: Why can't I reload the SQL script I dumped in the SQL window? > > A: The following limitations currently exist in SQL script execution: > >        * 'psql' commands such as '\connect' will not work at all. Wait a minute! They use the pg_dump utility

Re: [GENERAL] PG vs MSSQL language comparison ?

2012-05-29 Thread Grant Allen
On 27/05/2012 04:46, F. BROUARD / SQLpro wrote: >> It's a little out of date (I've been meaning to update it for about 2 years >> now) and has some gaps, but try the Database Rosetta Stone. >> >> http://www.grantondata.com/community/dbrosettastone.html > > Very out of date... Yep, agreed, as you

Re: [GENERAL] How to handle ALTER TABLE DROP CONSTRAINT, ADD CONSTRAINT USING INDEX with foreign keys

2012-05-29 Thread Adrian Klaver
On 05/29/2012 06:08 AM, Thomas Reiss wrote: Hello, PostgreSQL 9.1 introduced an ALTER TABLE DROP CONSTRAINT, ADD CONSTRAINT USING INDEX command to help index maintenance. I works for some cases, but I can't get it work with a primary key index which is referenced by a foreign key. Here's an exa

Re: [GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread François Beausoleil
Hi! Le 2012-05-29 à 06:18, Samba a écrit : > Is it possible stop/disable streaming replication without stopping or > restarting either master or slave servers? > > Since stopping or restarting the postgres servers would involve complete > invalidation of the connection pool [Java/JEE app serve

[GENERAL] How to handle ALTER TABLE DROP CONSTRAINT, ADD CONSTRAINT USING INDEX with foreign keys

2012-05-29 Thread Thomas Reiss
Hello, PostgreSQL 9.1 introduced an ALTER TABLE DROP CONSTRAINT, ADD CONSTRAINT USING INDEX command to help index maintenance. I works for some cases, but I can't get it work with a primary key index which is referenced by a foreign key. Here's an example of the problem I encounter : db=# CR

Re: [GENERAL] Export and import from one postgres server to another

2012-05-29 Thread Adrian Klaver
On 05/28/2012 11:27 AM, Alexander Reichstadt wrote: Hi, I am trying to "simply" export my postgres database from one server and then import it into another. I thought I could use PhpPgAdmin, but the hints on the web don't seem to work. One said to simply get a dump from one phpPgAdmin, the go t

[GENERAL] Disable Streaming Replication without restarting either master or slave

2012-05-29 Thread Samba
Hi, Is it possible stop/disable streaming replication without stopping or restarting either master or slave servers? Since stopping or restarting the postgres servers would involve complete invalidation of the connection pool [Java/JEE app server pool] that may take a few minutes before the appl

Re: [GENERAL] main log encoding problem

2012-05-29 Thread Craig Ringer
On 05/23/2012 09:15 AM, yi huang wrote: I'm using postgresql 9.1.3 from debian squeeze-backports with zh_CN.UTF-8 locale, i find my main log (which is "/var/log/postgresql/postgresql-9.1-main.log") contains "???" which indicate some sort of charset encoding problem. It's a known issue, I'm a