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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:32:03+00:00 2026-05-23T15:32:03+00:00

I have a text[] ARRAY column within a PostgreSQL table and I need to

  • 0

I have a text[] ARRAY column within a PostgreSQL table and I need to run char_length() on each element inside the array within a SELECT query (normal SQL, not plpgsql) so that if any of the elements is more than 25 characters long, the SELECT returns ‘t’ and ‘f’ otherwise. I know I can loop over the text[] within a custom plpgsql function but due to other reasons I need to find a way to do this in SQL directly.

Is it possible?

  • 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-23T15:32:03+00:00Added an answer on May 23, 2026 at 3:32 pm

    As of PostgreSQL 8.4, you can use the UNNEST function:

    SELECT MAX((char_length(string) > 25)::INT)::BOOLEAN
    FROM (
        SELECT my_array,UNNEST(my_array) AS string
        FROM my_table
    ) AS x
    GROUP BY my_array;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A column in my table contains email addresses. I have a text string that
Let's say I have a table column with 10 rows, each with <td id=num>
I have a text file containing three columns of numbers; one column each for
I have CSV text thats stored in the session array as csv. The lines
Say I have an array of values: string[] text = new string[] { val1,
I have the following code: $postcode = $form->createElement('text', 'postcode'); $postcode->setLabel('Post code:'); $postcode->addValidator('regex', false, array('/^[a-z]{1,3}[0-9]{1,3}
Here's an example of what I mean: I have an array: array('type'=>'text', 'class'=>'input', 'name'=>'username',
Basically, I have an array of keywords, and a piece of text. I am
I have text within a paragraph tag that that fits snug on the bottom
I am looking to create n-grams from text column in PostgreSQL. I currently split(on

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.