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. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 '14 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 '14 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 '14 at 7:14

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.