Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

hey guys i'm using PHP's codeigniter to create my application and postgreSQL as database and i have to update some value in database. So, let's say we have table structure like this:-

CREATE TABLE emailrecord (
   id serial NOT NULL,
   email json 
);

insert first record

INSERT INTO emailrecord (email) VALUES('{"id":"[email protected]"}');

Now, how to update the inserted record at 1 which is to be like this

'{{"id":"[email protected]"},{"id","[email protected]"}}'

AND

is there any way to update it via CODEIGNITER it would be helpful for me

share|improve this question
    
Why are you using JSON for this field? –  Colin 't Hart May 15 at 12:41
    
because it is just a example but i have to add many key value pair in it, different keys and different values –  vishal May 15 at 12:54
    
IMO, you should be putting each unique email in separate rows and you are duplicating id twice, when you use json, if you still want multiple values array is a better approach. OTH unique values will make updating/deleting easier. and just a thought json (in this case) will also increase your "autovaccum overheads". –  vedic Jun 7 at 7:14
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.