Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7086433
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:32:56+00:00 2026-05-28T07:32:56+00:00

I needed to insert an array field into a database and I was pleased

  • 0

I needed to insert an array field into a database and I was pleased to notice that PostGreSQL had that functionality. But now I am not able to insert the data using the tables active record.

I have tried the below calls with no success

$active_record->array_column = $_array_of_values;

which gives me the exception

Exception Raised:CDbCommand failed to execute the SQL statement: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: array value must start with “{” or dimension information

I have also tried this using

foreach($_array_of_values as $value){
    $active_record->array_column[] = $value;
}

which tells me

Indirect modification of overloaded property FeatureRaw::$colors_names has no effect

Can anyone help me with this?
Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:32:56+00:00Added an answer on May 28, 2026 at 7:32 am

    Data must be inserted in the form (text representation of an ARRAY):

    INSERT INTO tbl (arr_col) VALUES ('{23,45}')
    

    Or:

    INSERT INTO tbl (arr_col) VALUES ('{foo,"bar, with comma"}')
    

    So you need to enclose your array values in '{}' and separate them with comma ,. Use double quotes "" around text values that include a comma.

    I listed more syntax variants to insert arrays in a related answer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had a parametrized insert statement that was working well and I needed to
So I'm updating a tableview by inserting/deleting/reloading rows as needed, but, as I'm not
I am facing the problem to insert the data into dictionary. It is not
Here is my code, that isn't working, don't know why: $sql = `INSERT INTO
I am using this array of hashes to do a batch insert into a
I can insert, update, delete, etc. to a table in my MySQL database but
Using System.Move() to insert/delete item(s) from an array of string is not as easy
MS SQL Server doesn't have row level triggers, correct? If I needed to insert
Needed Finfo but deleted msi package, so uninstalled php 5.3.0, downloaded 5.3.2 and installed.
I needed to find all the files that contained a specific string pattern. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.