Re: [GENERAL] Pass where clause to a function

2014-08-14 Thread Andrew Bartley
Hi John, Thanks for the response I need this because it is a customer requirement. The underlying tables the api will query are dynamically created, they are period/content partitioned and distributed across multiple servers and database types... not just postgres. The api/function will

Re: [GENERAL] Trigger function cannot reference field name with capital letter

2014-08-14 Thread Patrick Dung
Thanks all for the help. BTW, letter casing is just a preference. Some people liked to use all small caps, some liked to use all big caps. I sometimes found that mixed case is more meaningful for the filed (eg. serialnumber vs serialNumber) What is your preference or suggestion? On Thursday,

Re: [GENERAL] Pass where clause to a function

2014-08-14 Thread John R Pierce
On 8/13/2014 10:59 PM, Andrew Bartley wrote: I need this because it is a customer requirement. The underlying tables the api will query are dynamically created, they are period/content partitioned and distributed across multiple servers and database types... not just postgres. The

Re: [GENERAL] PostgreSQL on AIX platform

2014-08-14 Thread Patrick Dung
Hi Payal, I haven't tried Postgresql on AIX. This web site provides binary and if you like to build yourself, it provided build instruction too. http://www.perzl.org/aix/ http://www.perzl.org/aix/index.php?n=Main.Instructions Thanks and regards, Patrick On Saturday, August 9, 2014 6:28 AM,

Re: [GENERAL] Trigger function cannot reference field name with capital letter

2014-08-14 Thread Pavel Stehule
Hi 2014-08-14 8:10 GMT+02:00 Patrick Dung patrick_...@yahoo.com.hk: Thanks all for the help. BTW, letter casing is just a preference. Some people liked to use all small caps, some liked to use all big caps. I sometimes found that mixed case is more meaningful for the filed (eg.

Re: [GENERAL] Pass where clause to a function

2014-08-14 Thread Alban Hertroys
On 14 Aug 2014, at 7:59, Andrew Bartley ambart...@gmail.com wrote: I need this because it is a customer requirement. The underlying tables the api will query are dynamically created, they are period/content partitioned and distributed across multiple servers and database types... not just

Re: [GENERAL] Postgres 9.3 tuning advice

2014-08-14 Thread dushy
Hello, On Wed, Aug 13, 2014 at 5:28 PM, Marti Raudsepp ma...@juffo.org wrote: On Wed, Aug 13, 2014 at 9:44 AM, Albe Laurenz laurenz.a...@wien.gv.at wrote: Set wal_buffers to 16MB so that a whole WAL segment will fit. No need, wal_buffers is automatically tuned now. If your shared_buffers

Re: [GENERAL] Trigger function cannot reference field name with capital letter

2014-08-14 Thread Adrian Klaver
On 08/13/2014 11:10 PM, Patrick Dung wrote: Thanks all for the help. BTW, letter casing is just a preference. Some people liked to use all small caps, some liked to use all big caps. I sometimes found that mixed case is more meaningful for the filed (eg. serialnumber vs serialNumber) What is

Re: [GENERAL] Pass where clause to a function

2014-08-14 Thread Merlin Moncure
On Thu, Aug 14, 2014 at 1:17 AM, John R Pierce pie...@hogranch.com wrote: On 8/13/2014 10:59 PM, Andrew Bartley wrote: I need this because it is a customer requirement. The underlying tables the api will query are dynamically created, they are period/content partitioned and distributed

Re: [GENERAL] Trigger function cannot reference field name with capital letter

2014-08-14 Thread Alban Hertroys
On 14 August 2014 08:10, Patrick Dung patrick_...@yahoo.com.hk wrote: Thanks all for the help. BTW, letter casing is just a preference. Some people liked to use all small caps, some liked to use all big caps. I sometimes found that mixed case is more meaningful for the filed (eg.

[GENERAL] How to cast to regprocedure with OUT parameters

2014-08-14 Thread Thomas Kellerer
Hello, pg_get_functiondef() can be used quite easily by using a cast to regprocedure, like this: select pg_get_functiondef('public.foo(text, text, text)'::regprocedure); However if the function is defined with an out parameter like this: create or replace function foo(p1 text, p2 out

Re: [GENERAL] How to cast to regprocedure with OUT parameters

2014-08-14 Thread Tom Lane
Thomas Kellerer spam_ea...@gmx.net writes: Hello, pg_get_functiondef() can be used quite easily by using a cast to regprocedure, like this: select pg_get_functiondef('public.foo(text, text, text)'::regprocedure); However if the function is defined with an out parameter like this:

Re: [GENERAL] How to cast to regprocedure with OUT parameters

2014-08-14 Thread Thomas Kellerer
Tom Lane wrote on 14.08.2014 17:33: Leave out the OUT parameters altogether: select pg_get_functiondef('public.foo(text, text)'::regprocedure); Only IN parameters contribute to the function's identity; OUT parameters are just a variant method of specifying its return type. Ah, great. I

[GENERAL] is there a way log last query in pg_stat_activity

2014-08-14 Thread Si Chen
I'm using Postgresql 9.0, and my pg_stat_activity.query seems to always be showing IDLE when no query is being run. Is there a way for it to show the last query, even if it was run a while ago? -- Si Chen Open Source Strategies, Inc. twitter.com/opentaps Unify social, email, and business

[GENERAL] Best practices for cloning DB servers

2014-08-14 Thread Andy Lau
Hi everyone, I had a question about some best practices. Our situation is that we want to be able to clone a database server. Our single database server is hosted in AWS, we take EBS snapshots every so often, and upload our WAL logs to S3. We want to be able to start a new server from a snapshot,

Re: [GENERAL] is there a way log last query in pg_stat_activity

2014-08-14 Thread Tom Lane
Si Chen sic...@opensourcestrategies.com writes: I'm using Postgresql 9.0, and my pg_stat_activity.query seems to always be showing IDLE when no query is being run. Is there a way for it to show the last query, even if it was run a while ago? More recent versions act that way. There is no

[GENERAL] How to modify parser in PostgreSQL to handle new keyword and parse it

2014-08-14 Thread Rajmohan C
I am working on implementing Selectivity hints feature in PostgreSQL 9.3.4. I am working on this only for using it in my academic research. I have decided to give selectivity information per relation as part of query like shown below. select * from lineitem, orders where l_extendedprice =2400 and

Re: [GENERAL] Best practices for cloning DB servers

2014-08-14 Thread Bill Mitchell
We are running our own Postgres server on AWS as well (since amazon RDS doesn't support read replicas yet) In out case, simply having a streaming replication standby works - and we do our pg_dump from that -- or simply snapshot the machine and then promote the replica to master to use full

Re: [GENERAL] Best practices for cloning DB servers

2014-08-14 Thread Joseph Kregloh
Why don't you try using Barman? It allows you to take snapshots and do PITR. Not to mention you can use it as it's intended purpose as a backup engine. -Joseph On Thu, Aug 14, 2014 at 1:53 PM, Bill Mitchell b...@publicrelay.com wrote: We are running our own Postgres server on AWS as well