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 7944633
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:36:36+00:00 2026-06-04T00:36:36+00:00

I saw a field text[] (text array) in Postgresql. As far as I understood,it

  • 0

I saw a field text[] (text array) in Postgresql.

As far as I understood,it can store multiple text data in a single column.

I tried to read more about it the manual: http://www.postgresql.org/docs/current/static/datatype-character.html but unfortunately nothing much was there about text[] column type.

So can anyone help me to understand

  • How to add a new value to text[] column?
  • What will be the resultset when we query to retrieve the values of text[] column?

    EDIT

    I have a table containing 2 columns group_name and members. Each time a new person join the group,the new person’s id should be inserted in the column members for that group_name. This is my requirement.A Group can contain ‘n’ number of members

    EDIT 2

    Pablo is asking me to use two tables instead. May I know how this could be solved by using two different tables? Right now I am using comma(,) to store multiple values separated by comma. Is this method wrong?

  • 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-06-04T00:36:37+00:00Added an answer on June 4, 2026 at 12:36 am

    To insert new values just do:

    insert into foo values (ARRAY['a', 'b']);
    

    Assuming you have this table:

    create table foo (a text[]);
    

    Every time you do a select a from foo you will have a column of type array:

    db1=> select a from foo;
       a   
    -------
     {a,b}
    (1 row)
    

    If you want a specific element from the array, you need to use subscripts (arrays in PostgreSQL are 1-based):

    db=> select a[1] from foo;
     a 
    ---
     a
    (1 row)
    

    Be careful when choosing an array datatype for your PostgreSQL tables. Make sure you don’t need a child table instead.

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

Sidebar

Related Questions

I saw some scala code that assign _ to a field of class, what
I saw this question Inject into private, package or public field or provide a
I got two simple input text fields in a HTML form: <input type=text name=data[User][name]
I was reading java bytecode and saw this: getfield #5 (Field java.lang.String name) What
I experienced an issue retrieving encrypted data from an NVARCHAR field in our SQL
From what I saw, in Firefox and Chrome, the color of the text cursor
I saw that __VIEWSTATE field gets rendered even though I have set the EnableViewState=false
Checking in the new database structure I saw that someone changed a field from
I have a text field in a form_tag on my index page that should
I'm trying to attach a JQuery datepicker to a text field on a form,

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.