Business extension fields are often stored in json format data in the database, which involves a headache. Suppose you want to use a certain value in the extension field as a query condition. It turns out that PostgreSQL itself supports this query method. .
Example: Suppose the json format stored in the business extension field ext_data is as follows:
We need to query all the data of extInfo.userType=1 in the extended field, then the corresponding SQL statement is as follows:
select * from event_log where (ext_data::json#>>'{extInfo,userType}')::text = '1'