Gerhardpet
asked on
Update a hstore field in PostgreSQL database
We support a system where custom fields in the system are stored as hstore fields. Like this
select query
""LocOver"=>"", "freight"=>"0", "3M Codes"=>"", "V_Partno"=>"110SP-60", "brokerage"=>"0", "Dentsply C"=>"""
Here is the data for one record. LocOver, freight, 3M Code, V_Partno, brokerge, Dentsply are the field names in the system
I want to update
I want to update the udf_data column with the values from inventory.part_no column from the udf_data V_Partno
So the update statement should be like this:
update customers
set udf_data = misc1
where udf_data ?| '{cust_type}'
But the hstore has a particular update statement like this:
update customers set udf_data = udf_data || '"cust_type"=>"test"'::hst ore
Which does not work. Can anyone help?
select query
select udf_data from inventory
""LocOver"=>"", "freight"=>"0", "3M Codes"=>"", "V_Partno"=>"110SP-60", "brokerage"=>"0", "Dentsply C"=>"""
Here is the data for one record. LocOver, freight, 3M Code, V_Partno, brokerge, Dentsply are the field names in the system
I want to update
I want to update the udf_data column with the values from inventory.part_no column from the udf_data V_Partno
So the update statement should be like this:
update customers
set udf_data = misc1
where udf_data ?| '{cust_type}'
But the hstore has a particular update statement like this:
update customers set udf_data = udf_data || '"cust_type"=>"test"'::hst
Which does not work. Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER