[GENERAL] idle processes

2015-08-05 Thread Johann Spies
I have read quite a variety of stuff on the internet about an explanation for idle postgresql processes but still do not understand the following typical scenario. This is on Debian (postgresql 9.4.4-1.pgdg80+1). Running the following (as user crest) on an empty table using psql: select * from w

[GENERAL] json ->> operator precedence

2015-08-05 Thread Geoff Winkless
An interesting quirk: # select CASE WHEN '{"a":null}'::jsonb->>'a' IS NULL THEN 'yes' ELSE 'no' END; case -- yes According to the precedence table http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html I would expect ->> to come under "all other native and user-defined operators"

Re: [GENERAL] json ->> operator precedence

2015-08-05 Thread John McKown
On Wed, Aug 5, 2015 at 5:02 AM, Geoff Winkless wrote: > An interesting quirk: > > # select CASE WHEN '{"a":null}'::jsonb->>'a' IS NULL THEN 'yes' ELSE 'no' > END; > case > -- > yes > > According to the precedence table > http://www.postgresql.org/docs/9.4/static/sql-syntax-lexical.html I w

Re: [GENERAL] idle processes

2015-08-05 Thread Adrian Klaver
On 08/05/2015 12:38 AM, Johann Spies wrote: I have read quite a variety of stuff on the internet about an explanation for idle postgresql processes but still do not understand the following typical scenario. This is on Debian (postgresql 9.4.4-1.pgdg80+1). Running the following (as user crest)

Re: [GENERAL] json ->> operator precedence

2015-08-05 Thread Geoff Winkless
On 5 August 2015 at 14:35, John McKown wrote: > > ​Looks correct to me. As I understand it the ::jsonb is NOT an operator! > It is a syntactic construct for a CAST(). An equivalent which might make > more sense is: > ​My issue is nothing to do with the ::jsonb cast, it's the precedence of the ->>

Re: [GENERAL] json ->> operator precedence

2015-08-05 Thread John McKown
On Wed, Aug 5, 2015 at 8:35 AM, John McKown wrote: > ​​ > > ​Looks correct to me. As I understand it the ::jsonb is NOT an operator! > It is a syntactic construct for a CAST(). An equivalent which might make > more sense is: > > select CASE WHEN CAST('{"a":null}' AS JSONB)->>'a' IS NULL THEN 'yes

Re: [GENERAL] idle processes

2015-08-05 Thread Tom Lane
Johann Spies writes: > I have read quite a variety of stuff on the internet about an explanation > for idle postgresql processes but still do not understand the following > typical scenario. > This is on Debian (postgresql 9.4.4-1.pgdg80+1). > Running the following (as user crest) on an empty ta

Re: [GENERAL] json ->> operator precedence

2015-08-05 Thread John McKown
On Wed, Aug 5, 2015 at 8:42 AM, Geoff Winkless wrote: > On 5 August 2015 at 14:35, John McKown > wrote: >> >> ​Looks correct to me. As I understand it the ::jsonb is NOT an operator! >> It is a syntactic construct for a CAST(). An equivalent which might make >> more sense is: >> > > ​My issue is

Re: [GENERAL] json ->> operator precedence

2015-08-05 Thread Tom Lane
Geoff Winkless writes: > An interesting quirk: > # select CASE WHEN '{"a":null}'::jsonb->>'a' IS NULL THEN 'yes' ELSE 'no' > END; > case > -- > yes Apparently you're running that on 9.5 or HEAD. > According to the precedence table > http://www.postgresql.org/docs/9.4/static/sql-syntax-lexi

Re: [GENERAL] json ->> operator precedence

2015-08-05 Thread Geoff Winkless
On 5 August 2015 at 14:52, Tom Lane wrote: > > The first compatibility item in the 9.5 release notes: we changed > the precedence of IS and some other things. You need to be reading > the 9.5 version of the precedence table. ​Doh. Sorry, I'm an idiot.​

Re: [GENERAL] Question about copy from with timestamp format

2015-08-05 Thread Murali M
Hi everyone, First of all, let me thank all of you for the very informative discussion. I will say my solution was to declare the field MMDDHH24 as int (can handle till Dec 31, 2147, Hr23 -- which will be 2147123123). Also this way, I can still use between etc to select a range of dates.. of c

Re: [GENERAL] Question about copy from with timestamp format

2015-08-05 Thread Adrian Klaver
On 08/05/2015 09:16 AM, Murali M wrote: Hi everyone, First of all, let me thank all of you for the very informative discussion. I will say my solution was to declare the field MMDDHH24 as int (can handle till Dec 31, 2147, Hr23 -- which will be 2147123123). Also this way, I can still use bet