Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-11 Thread Kiran
Hi Jim, The issue is now resolved thanks to Tom and Adrian. regards Kiran On Sun, Sep 11, 2016 at 4:16 AM, Jim Nasby wrote: > On 9/10/16 6:03 AM, Kiran wrote: > >> If I insert a record from my application using following code : >> db.myschema.cf_question.insert({ >>

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Jim Nasby
On 9/10/16 6:03 AM, Kiran wrote: If I insert a record from my application using following code : db.myschema.cf_question.insert({ cf_question_type_id:request.payload.type_id, cf_question_category_id:request.payload.cat_id, lang:request.payload.lang, body:request.payload.body } The above app code

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Dear Tom, Adrian, Excellent catch! Thank you very very much to both. It is resolved now. I can sleep now. Good night from Sweden. regards Kiran On Sat, Sep 10, 2016 at 11:18 PM, Adrian Klaver wrote: > On 09/10/2016 02:09 PM, Kiran wrote: > >> Hi Adrian, >> >> The

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Adrian Klaver
On 09/10/2016 02:09 PM, Kiran wrote: Hi Adrian, The JSON value is inserted into a column in the database which I can see. But the trigger which has to convert this JSON value in not tsvector column is not updating that column. As Tom explained, in your trigger function you have:

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Hi Adrian, The JSON value is inserted into a column in the database which I can see. But the trigger which has to convert this JSON value in not tsvector column is not updating that column. regards On Sat, Sep 10, 2016 at 10:27 PM, Tom Lane wrote: > Kiran

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Adrian Klaver
On 09/10/2016 02:02 PM, Kiran wrote: Hi Tom, I have checked and the trigger is not disabled. and \drds results Role=blank database = mydatabase settings = default_text_search_config=pg_catalog.swedish Any other tips or suggestions please. Did you see this post?:

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Hi Tom, I have checked and the trigger is not disabled. and \drds results Role=blank database = mydatabase settings = default_text_search_config=pg_catalog.swedish Any other tips or suggestions please. regards Kiran On Sat, Sep 10, 2016 at 9:26 PM, Tom Lane wrote: >

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Tom Lane
Kiran writes: > LOG: execute : INSERT INTO "myschema"."cf_question" > ("cf_question_type_id", "cf_question_category_id", "lang", "body") VALUES > ($1, $2, $3, $4) RETURNING * > DETAIL: parameters: $1 = '1', $2 = '9', $3 = 'swedish', $4 = '{"name": "Do > you like Pizza

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Hi Adrian, This is the exact log in the file as it appears: DETAIL: parameters: $1 = '', $2 = '' LOG: connection received: host=localhost port=53284 LOG: connection authorized: user=deva database=mydatabase LOG: connection received: host=localhost port=53285 LOG: connection authorized:

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Tom Lane
Kiran writes: > But I do not know how to check whether the application is subject to > different ALTER USER SET parameters. psql's \drds ("display role/database SETs") would help. BTW, have you checked that the trigger is not disabled, and that there isn't

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Adrian Klaver
On 09/10/2016 11:39 AM, Kiran wrote: Hi Adrian, Thanks for your response. I tried with logging. The application is inserting the record that I am passing into the database. But the trigger is not firing. What is the text of the complete statement as it appears in the logs? When you do the

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Dear Tom, Thanks for your detailed reply. (1) Application is connecting to the same database. (2) Application is inserting to the same table without much luck with the trigger. (3) Application is issuing the right insert command. (4) I am not able to check this, is there any way I can check

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Hi Adrian, Thanks for your response. I tried with logging. The application is inserting the record that I am passing into the database. But the trigger is not firing. I have been looking into this issue since morning with out any positive outcome :(. If you have any other tips, it will be really

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Tom Lane
Adrian Klaver writes: > On 09/10/2016 03:59 AM, Kiran wrote: >> What could be the problem ? Why trigger is not working if I insert from the >> application ? Am I doing anything wrong ? > If you have not, turn on log_statement: >

Re: [GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Adrian Klaver
On 09/10/2016 03:59 AM, Kiran wrote: Hi, *Problem background :* I have a *function in the DB* as follows CREATE FUNCTION question_tsv_trigger() RETURNS trigger AS $BODY$ begin New.weighted_tsv := to_tsvector('swedish',coalesce(New.body->>'qtext','')::text); RAISE NOTICE 'TRIGER called on %',

[GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Hi, *Problem background :* I have a *function in the DB* as follows CREATE FUNCTION question_tsv_trigger() RETURNS trigger AS $BODY$ begin New.weighted_tsv := to_tsvector('swedish',coalesce(New.body->>'qtext','')::text); RAISE NOTICE 'TRIGER called on %', TG_TABLE_NAME; return New; end $BODY$

[GENERAL] Trigger is not working for Inserts from the application

2016-09-10 Thread Kiran
Hi, *Problem background :* I have a *function in the DB* as follows CREATE FUNCTION question_tsv_trigger() RETURNS trigger AS $BODY$ begin New.weighted_tsv := to_tsvector('swedish',coalesce(New.body->>'qtext','')::text); RAISE NOTICE 'TRIGER called on %', TG_TABLE_NAME; return New; end $BODY$