Tibco and postgres work with Json and Jsonb datatypes

Postgres database allows to insert and query json documents. To insert a json or jsonb object from tibco 5 we need to type cast and insert the object.

Have a look at the followin here we are casting two json string to json and jsonb data types columns.

The insert query is as following

INSERT INTO vehiclelocation.locations
VALUES(?,?::json,?::jsonb)

Now the json document can be queried as following.

Following is the select query where we query the busid and busserial from a json array of vehicle store in a table called locations.

select elem->>'bus_id' as busid, elem->>'bus_serial' as busserial
from vehiclelocation.locations t,
json_array_elements(t."location" ->'Vehicle') elem
where t.company_id = 26 and elem->>'bus_id' = '1'

About: Muhammad Ali

I am a Java and Tibco expert. I have Master's degree in software engineering of distributed systems from Royal Institute of technology KTH Stockholm Sweden and I am an expert software engineer and integrator with over a decade of industry experience from Europe, Gulf and Asia regions. I am a strong opensource believer and encourage "sharing as caring" principle.