[GENERAL] Concatenating NULL with JSONB value return NULL

2016-12-18 Thread Jong-won Choi
PostgreSQL 9.6.1 Hi I have a NULL-able JSONB type column and want to perform upsert, concatenating with the existing value. The query looks like (campaigns and facts columns are JSONB type, in the below) : INSERT INTO Fan (oid, campaigns, facts) VALUES (189,'{"campaign-id": "12345"}','{

Re: [GENERAL] Concatenating NULL with JSONB value return NULL

2016-12-18 Thread Jong-won Choi
on writes: On Sun, Dec 18, 2016 at 6:08 PM, John R Pierce wrote: On 12/18/2016 2:52 PM, Jong-won Choi wrote: I have a NULL-able JSONB type column and want to perform upsert, concatenating with the existing value. NULL does not mean 'NO' value in SQL it means UNKNOWN val

[GENERAL] Row level security policy - calling function for right hand side value of 'in' in using_expression

2017-02-02 Thread Jong-won Choi
I have a RLS policy definition like: CREATE POLICY promoter_policy ON Agency USING (promoter in build_valid_promoter_list()) WITH CHECK (promoter in build_valid_promoter_list()); The build_valid_promoter_list function definition is: CREATE OR REPLACE FUNCTION bu

Re: [GENERAL] Row level security policy - calling function for right hand side value of 'in' in using_expression

2017-02-03 Thread Jong-won Choi
END $$; Have a great weekend! - Jong-won On 03/02/17 17:14, Tom Lane wrote: > Jong-won Choi writes: >> I have a RLS policy definition like: >> CREATE POLICY promoter_policy ON Agency >> USING (promoter in build_valid_promoter_list()) >

[GENERAL] Unexpected behaviour of 'DEFERRABLE INITIALLY DEFERRED'

2015-11-25 Thread Jong-won Choi
Hi all, This is from my local PostgreSQL log: LOG: statement: begin; LOG: statement: INSERT INTO site_owner (email, name, pwhash, data) VALUES ('xyz', 'xyz', crypt('xyz', gen_salt('bf', 8)), '{}'::JSONB) RETURNING id; LOG: statement: INSERT INTO site (owner, name, timezone, data) VALUE

[GENERAL] array_to_json - dealing with returning no rows

2017-02-28 Thread Jong-won Choi
Hi all, In my program, I generate SQLs from definitions, an example is: (define-db-resource Event [{:oid{:type :bigserial :primary-key true}} {:name{:type :text :not-null true}} {:tour-oid {:type :bigint :not-null true :references [Tour :oid]}} {:tour

Re: [GENERAL] array_to_json - dealing with returning no rows

2017-02-28 Thread Jong-won Choi
I've just found array_remove! Cheers - Jong-won On 01/03/17 12:31, Jong-won Choi wrote: Hi all, In my program, I generate SQLs from definitions, an example is: (define-db-resource Event [{:oid{:type :bigserial :primary-key true}} {:name{:type :text :not-null