Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Yvon Thoraval
Fine, thanks it's shorter than mine and works too. I'll adopt it )) 2012/11/7 Alban Hertroys > On 7 Nov 2012, at 6:33, Yvon Thoraval wrote: > > > CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select > character_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE ON NULL > INPUT; > > Tr

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Alban Hertroys
On 7 Nov 2012, at 6:33, Yvon Thoraval wrote: > CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select > character_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE ON NULL INPUT; Try: CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select coalesce(character_length($1) > 0, false);'

[GENERAL] The bug reporting form are unavailable

2012-11-06 Thread Tianyin Xu
What I experienced when submitting a bug report is Forbidden (403) CSRF verification failed. Request aborted. More information is available with DEBUG=True. t -- Tianyin XU, http://cseweb.ucsd.edu/~tixu/

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Tom Lane
Yvon Thoraval writes: > CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select > character_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE ON NULL > INPUT; FWIW, "RETURNS NULL ON NULL INPUT" is a formulaic phrase specified in the SQL standard. It's not meant to be something you can plu

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Yvon Thoraval
Fine thanks,I've found that way : recettes=> DROP FUNCTION has_infos(text); DROP FUNCTION recettes=> CREATE FUNCTION has_infos(text DEFAULT '') RETURNS boolean AS $BODY$ recettes$> BEGIN recettes$> IF character_length($1) > 0 THEN recettes$> RETURN TRUE; recettes$> ELSE recettes$> RETURN FALS

Re: [GENERAL] Tuning / performance questions

2012-11-06 Thread Craig Ringer
On 11/07/2012 01:29 PM, Bryan Montgomery wrote: > Thanks for the insight. I know why some of the settings were set, but > there are others that have been highlighted that now don't make sense. > I'll strongly recommend adjusting those now. Good. If you've been running with fsync=off all this time I

Re: [GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread David Johnston
On Nov 7, 2012, at 0:33, Yvon Thoraval wrote: > I'd like to create a function : > returning true if the length of the text arg is greater than 0 ; > false otherwise ; > > and also returning false when arg is NULL, then i wrote : > > CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select >

[GENERAL] creating a function returning FALSE on NULL input ?

2012-11-06 Thread Yvon Thoraval
I'd like to create a function : returning true if the length of the text arg is greater than 0 ; false otherwise ; and also returning false when arg is NULL, then i wrote : CREATE FUNCTION has_infos(text) RETURNS boolean AS 'select character_length($1) > 0;' LANGUAGE SQL IMMUTABLE RETURNS FALSE O

Re: [GENERAL] Tuning / performance questions

2012-11-06 Thread Bryan Montgomery
Thanks for the insight. I know why some of the settings were set, but there are others that have been highlighted that now don't make sense. I'll strongly recommend adjusting those now. On Tue, Nov 6, 2012 at 8:54 PM, Craig Ringer wrote: > Thanks for including your configuration and version; it

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Mike Lewis
> > Uh, txid_current returns a 64 bit value, whereas xmin only stores the 32 > least significant bits. They would certainly differ after a xid > wraparound. > > -- > Álvaro Herrerahttp://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services > Ah yes...

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Alvaro Herrera
Mike Lewis escribió: > I am trying to make a trigger that updates a row once and only once per > transaction (even if this trigger gets fired multiple times). The general > idea is that for a user we have a version number. When we modify the > user's data, the version number is incremented then s

Re: [GENERAL] Tuning / performance questions

2012-11-06 Thread Craig Ringer
Thanks for including your configuration and version; it makes things much easier. Reply follows inline. On 11/06/2012 09:04 PM, Bryan Montgomery wrote: > I'm wondering what general ways there are to monitor and improve > performance? We look at pgadmin's server status but that only sees the > fun

Re: [GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Sergey Konoplev
On Tue, Nov 6, 2012 at 2:55 PM, Mike Lewis wrote: > I am trying to make a trigger that updates a row once and only once per > transaction (even if this trigger gets fired multiple times). The general > idea is that for a user we have a version number. When we modify the user's > data, the versio

[GENERAL] Comparing txid_current() to xmin

2012-11-06 Thread Mike Lewis
I am trying to make a trigger that updates a row once and only once per transaction (even if this trigger gets fired multiple times). The general idea is that for a user we have a version number. When we modify the user's data, the version number is incremented then set on the object. We only ne

Re: [GENERAL] fuzzystrmatch module buggy? observations

2012-11-06 Thread Bruce Momjian
On Tue, Oct 30, 2012 at 02:29:09PM +0100, r d wrote: > The fuzzystrmatch module (http://www.postgresql.org/docs/9.2/static/ > fuzzystrmatch.html) is currently, as of 9.2.1, documented with the caution "At > present, the soundex, metaphone, dmetaphone, and dmetaphone_alt functions do > not work well

[GENERAL] SPI function varchar difference between 9.0 and 9.2

2012-11-06 Thread Achilleas Mantzios
(pls, include me in the reply, i am resending this from here since the one sent from achill(at)matrix(dot)gatewaynet(dot)com didn't make it for some reason) Hello, we are using and still maintaining a heavily modified version of DBMirror in our infrastructure, involving one master and 80 (and

Re: [GENERAL] Memory issue on FreeBSD

2012-11-06 Thread Vick Khera
On Mon, Nov 5, 2012 at 10:11 AM, Frank Broniewski wrote: > and this is after a few hours of running: > > Mem: 91M Active, 17G Inact, 3983M Wired, 1526M Cache, 3283M Buf, 155M Free > Swap: 4096M Total, 828K Used, 4095M Free > > For comparison, here is the output of a 32GB FreeBSD 9.0/amd64 server,

Re: [GENERAL] Unexpectedly high disk space usage

2012-11-06 Thread Tom Lane
Jeff Janes writes: > On Tue, Nov 6, 2012 at 10:49 AM, Lists wrote: >> I followed your example, the result is at the bottom. Based on this it would >> seem that there are 3-4 databases that seem to be the culprit. How could I >> get more depth/detail on what specifically is the problem? > If you

Re: [GENERAL] Unexpectedly high disk space usage

2012-11-06 Thread Jeff Janes
On Tue, Nov 6, 2012 at 10:49 AM, Lists wrote: > I followed your example, the result is at the bottom. Based on this it would > seem that there are 3-4 databases that seem to be the culprit. How could I > get more depth/detail on what specifically is the problem? If you have installed the contrib

Re: [GENERAL] Unexpectedly high disk space usage

2012-11-06 Thread Lists
I followed your example, the result is at the bottom. Based on this it would seem that there are 3-4 databases that seem to be the culprit. How could I get more depth/detail on what specifically is the problem? -Ben On 11/05/2012 07:10 PM, Scott Marlowe wrote: What does du -sh have to say abou

Re: [GENERAL] Unexpectedly high disk space usage

2012-11-06 Thread Lists
Jeff, thanks for the feedback! On 11/05/2012 08:51 PM, Jeff Janes wrote: My first guesses would be things that are not directly under the databases control, such as: 1) your server logs are accumulating and you aren't doing anything about them I'm guessing that this is not the case: [root@de

Re: [GENERAL] sub query reference error or user error

2012-11-06 Thread David Johnston
On Nov 6, 2012, at 12:36, sivakumar krishnamurthy wrote: > Hi All, > For the below test case shouldn't the update statement throw error because > the sub query projects a column which is not existing in the table. For ex in > inner select nos1 column exists in t1 and not t2. > Is this a bug

Re: [GENERAL] Question about "ident_file" in postgres.conf

2012-11-06 Thread Tianyin Xu
I see. Thanks a lot for the explanation! Tianyin On Tue, Nov 6, 2012 at 8:32 AM, Magnus Hagander wrote: > On Tue, Nov 6, 2012 at 5:25 PM, Jeff Janes wrote: > >> On Tue, Nov 6, 2012 at 3:16 AM, Magnus Hagander >> wrote: >> > On Tue, Nov 6, 2012 at 9:08 AM, Tianyin Xu wrote: >> >> >> >> Hi, a

Re: [GENERAL] Tuning / performance questions

2012-11-06 Thread Kevin Grittner
Bryan Montgomery wrote: > We have a system, that due to recent events is getting a lot > heavier use. The application makes extensive use of functions. > These functions would typically run sub-second but now can take > several seconds. > The server is running on suse 11.4 with 8 vcpu and 32Gb ra

Re: [GENERAL] Hot Standby Not So Hot Anymore

2012-11-06 Thread Ian Harding
On Tue, Nov 6, 2012 at 5:45 AM, Kevin Grittner wrote: > Darren Duncan wrote: > > Ian Harding wrote: > > >> It says everything is happy as normal... > >> > >> 2012-11-05 16:22:41.200 PST - :LOG: invalid record length at BA6/6DCBA48 > > > > What does this log line mean? Is that "happy as normal"? >

Re: [GENERAL] Question about "ident_file" in postgres.conf

2012-11-06 Thread Magnus Hagander
On Tue, Nov 6, 2012 at 5:25 PM, Jeff Janes wrote: > On Tue, Nov 6, 2012 at 3:16 AM, Magnus Hagander > wrote: > > On Tue, Nov 6, 2012 at 9:08 AM, Tianyin Xu wrote: > >> > >> Hi, all, > >> > >> I have a question regarding the "ident_file" configuration entry. > >> > >> Why the server refused to s

Re: [GENERAL] Question about "ident_file" in postgres.conf

2012-11-06 Thread Jeff Janes
On Tue, Nov 6, 2012 at 3:16 AM, Magnus Hagander wrote: > On Tue, Nov 6, 2012 at 9:08 AM, Tianyin Xu wrote: >> >> Hi, all, >> >> I have a question regarding the "ident_file" configuration entry. >> >> Why the server refused to start without specifying the "ident_file", but >> it never cares whethe

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-06 Thread Tom Lane
"Kevin Grittner" writes: > Now, if you wanted to argue that *this* query might depend on time > zone information, I'd be more willing to believe it, and maybe the > problem is that we use the same function for both: > SELECT TIMESTAMPTZ '2012-10-28 01:30:00' + INTERVAL '1 day'; The "problem" is

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-06 Thread Kevin Grittner
Albe Laurenz wrote: > Thomas Munro wrote: >> I am using 9.1.6, and I've set up a partitioned table as described >> in the manual, with partitions based on a timestamptz column >> called 'time'. The exclusion constraints work nicely when I select >> ranges of times with literal constants. But why wo

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-06 Thread Kevin Grittner
hari.fu...@gmail.com > No: the result of e.g. > >  SELECT TIMESTAMPTZ '2012-10-28 01:30:00' + INTERVAL '24 hours'; > > depends on the client's timezone and its DST rules. Can you give an example of where adding an interval based on *hours* to TIMESTAMP WITH TIME ZONE would give a different valu

Re: [GENERAL] Hot Standby Not So Hot Anymore

2012-11-06 Thread Kevin Grittner
Darren Duncan wrote: > Ian Harding wrote: >> It says everything is happy as normal... >> >> 2012-11-05 16:22:41.200 PST - :LOG: invalid record length at BA6/6DCBA48 > > What does this log line mean? Is that "happy as normal"? Note that the message level is LOG, not WARNING or ERROR or anything

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-06 Thread Albe Laurenz
hari.fu...@gmail.com wrote: > > I think the problem is that this + operator is implemented > > by the function "timestamptz_pl_interval", which is STABLE > > but not IMMUTABLE. > > > > I am not sure why this function cannot be IMMUTABLE, it > > seems to me that it should be. > > No: the result of

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-06 Thread hari . fuchs
"Albe Laurenz" writes: > I think the problem is that this + operator is implemented > by the function "timestamptz_pl_interval", which is STABLE > but not IMMUTABLE. > > I am not sure why this function cannot be IMMUTABLE, it > seems to me that it should be. No: the result of e.g. SELECT TIME

[GENERAL] Tuning / performance questions

2012-11-06 Thread Bryan Montgomery
Hello experts! (and other like me). ** We have a system, that due to recent events is getting a lot heavier use. The application makes extensive use of functions. These functions would typically run sub-second but now can take several seconds. I'm wondering what general ways there are to monitor

Re: [GENERAL] Problem with streaming replication over SSL

2012-11-06 Thread Magnus Hagander
On Tue, Nov 6, 2012 at 12:47 PM, Albe Laurenz wrote: > Magnus Hagander wrote: > >> I have streaming replication configured over SSL, and > >> there seems to be a problem with SSL renegotiation. > [...] > >> After that, streaming replication reconnects and resumes working. > >> > >> Is this an over

Re: [GENERAL] Problem with streaming replication over SSL

2012-11-06 Thread Albe Laurenz
Magnus Hagander wrote: >> I have streaming replication configured over SSL, and >> there seems to be a problem with SSL renegotiation. [...] >> After that, streaming replication reconnects and resumes working. >> >> Is this an oversight in the replication protocol, or is this >> working as designe

Re: [GENERAL] Question about "ident_file" in postgres.conf

2012-11-06 Thread Magnus Hagander
On Tue, Nov 6, 2012 at 9:08 AM, Tianyin Xu wrote: > Hi, all, > > I have a question regarding the "ident_file" configuration entry. > > Why the server refused to start without specifying the "ident_file", but > it never cares whether the given "ident_file" is valid or not? In other > word, a misco

Re: [GENERAL] Problem with streaming replication over SSL

2012-11-06 Thread Magnus Hagander
On Tue, Nov 6, 2012 at 10:47 AM, Albe Laurenz wrote: > I have streaming replication configured over SSL, and > there seems to be a problem with SSL renegotiation. > > This is from the primary's log: > > 2012-11-06 00:13:10.990 > CET,"replication","",5204,"10.153.109.3:49889",509843df.1454,10,"stre

Re: [GENERAL] Exclusion constraints with time expressions

2012-11-06 Thread Albe Laurenz
Thomas Munro wrote: > I am using 9.1.6, and I've set up a partitioned table as described in the manual, with partitions > based on a timestamptz column called 'time'. The exclusion constraints work nicely when I select > ranges of times with literal constants. But why would a WHERE clause like th

[GENERAL] Problem with streaming replication over SSL

2012-11-06 Thread Albe Laurenz
I have streaming replication configured over SSL, and there seems to be a problem with SSL renegotiation. This is from the primary's log: 2012-11-06 00:13:10.990 CET,"replication","",5204,"10.153.109.3:49889",509843df.1454,10,"streami ng 1E3/76D64000",2012-11-05 23:55:27 CET,4/0,0,LOG,08P01,"SSL

Re: [GENERAL] Does PostgreSQL have complete functional test cases?

2012-11-06 Thread Tianyin Xu
Thanks again! t On Tue, Nov 6, 2012 at 12:24 AM, Pavel Stehule wrote: > 2012/11/6 Tianyin Xu : > > Thanks, Pavel! > > > > I see. So the regress test cases are the complete functional testing? Am > I > > right? > > yes > > > > > (I thought they're test cases for regression) > > > > T > > > > > >

Re: [GENERAL] Does PostgreSQL have complete functional test cases?

2012-11-06 Thread Pavel Stehule
2012/11/6 Tianyin Xu : > Thanks, Pavel! > > I see. So the regress test cases are the complete functional testing? Am I > right? yes > > (I thought they're test cases for regression) > > T > > > > > On Tue, Nov 6, 2012 at 12:00 AM, Pavel Stehule > wrote: >> >> hello >> >> 2012/11/6 Tianyin Xu : >

Re: [GENERAL] Does PostgreSQL have complete functional test cases?

2012-11-06 Thread Tianyin Xu
Thanks, Pavel! I see. So the regress test cases are the complete functional testing? Am I right? (I thought they're test cases for regression) T On Tue, Nov 6, 2012 at 12:00 AM, Pavel Stehule wrote: > hello > > 2012/11/6 Tianyin Xu : > > Hi, > > > > Does anyone know whether PostgreSQL has co

[GENERAL] Question about "ident_file" in postgres.conf

2012-11-06 Thread Tianyin Xu
Hi, all, I have a question regarding the "ident_file" configuration entry. Why the server refused to start without specifying the "ident_file", but it never cares whether the given "ident_file" is valid or not? In other word, a misconfigured non-existent path for "ident_file" can also start the s

Re: [GENERAL] Does PostgreSQL have complete functional test cases?

2012-11-06 Thread Pavel Stehule
hello 2012/11/6 Tianyin Xu : > Hi, > > Does anyone know whether PostgreSQL has complete functional test cases? And > where can I find them? > > Currently, I only find some test cases in "PG_SOURCE/src/tests", but it > seems that they are pretty simple and do not cover a lot of features of > Postgr