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

  • Home
  • SEARCH
  • 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 6475655
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:43:51+00:00 2026-05-25T06:43:51+00:00

I have built a series of views in a PostgreSQL database that includes a

  • 0

I have built a series of views in a PostgreSQL database that includes a couple of array columns. The view definition is as follows:

create view articles_view as 
  (select articles.*,
   array(select row(people.*)::people 
     from people 
     where articles.spubid=people.spubid and 
       people.stype='Author' and 
       bactive='t' 
     order by people.iorder) as authors,
   array(select row(people.*)::people 
     from people 
     where articles.spubid=people.spubid and 
       people.stype='Editor' and 
       bactive='t' 
     order by people.iorder) as editors,
   array(select row(people.*)::people 
     from people 
     where articles.spubid=people.spubid and 
       people.stype='Reviewer' and 
       bactive='t'
     order by people.iorder) as reviewers,
   array(select row(status.*)::status 
     from status 
     where articles.spubid=status.spubid and 
       bactive='t') as status
  from articles 
  where articles.bactive='t');

Essentially what I want to do is an iLike on the ‘author’ column to determine if a specific user id exists in that array. Obviously I can’t use iLike on that datatype so I need to find another approach.

Here is an example of data in the ‘authors’ array:

{“(2373,t,f,f,\”2011-08-01
11:57:40.696496\”,/Pubs/pubs_edit_article.php,\”2011-08-09
15:36:29.281833\”,000128343,A00592,Author,1,Nicholas,K.,Kreidberg,\”\”,123456789,t,Admin,A,A,A,0,\”\”)”,”(2374,t,f,f,\”2011-08-01
11:57:40.706617\”,/Pubs/pubs_edit_article.php,\”2011-08-09
15:36:29.285428\”,000128343,A00592,Author,2,John,D.,Doe,\”\”,234567890,t,IT,A,A,A,0,\”\”)”,”(2381,t,f,f,\”2011-08-09
14:45:14.870418\”,000128343,\”2011-08-09
15:36:29.28854\”,000128343,A00592,Author,3,Jane,E,Doe,\”\”,345678901,t,Admin,A,A,A,,\”\”)”,”(2383,t,f,f,\”2011-08-09
15:35:11.845283\”,567890123,\”2011-08-09
15:36:29.291388\”,000128343,A00592,Author,4,Test,T,Testerton,\”\”,TestTesterton,f,N/A,A,A,A,,\”\”)”}

What I want to be able to do is a query the view and find out if the string ‘123456789’ (that is the user id assigned to Nicholas Kreidberg in the array) exists in the array. I don’t care which user it is assigned to or where it appears in the array, all I need to know is if ‘123456789’ shows up anywhere in the array.

Once I know how to write a query that determines if the condition above is true then my application will simply execute that query and if rows are returned it will know that the user id passed to the query is an author for that publication and proceed accordingly.

Thanks in advance for any insight that can be provided on this topic.

  • 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-25T06:43:51+00:00Added an answer on May 25, 2026 at 6:43 am

    Might this:

    select ... 
      from ... 
     where ... 
           and array_to_string(authors, ', ') like '%123456789%';`
    

    do the trick?

    Otherwise, there is the unnest function…

    The “Array Functions and Operators” chapter has more details.

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

Sidebar

Related Questions

I have built a MS Access 2007 application that can create reports files in
I have a series of controllers and associated views within my app that exist
I have a view that generates an image based on a series of layers.
I have built an MSI that I would like to deploy, and update frequently.
I have built an application in C# that I would like to be optimized
I have built a .dll under WinXP that claims it can't find DWMAPI.DLL when
I have built an application that uses SQL Express 2005 and I want to
My main form in my application has a datagrid view that can have 1
I have a (C#) genetic program that uses financial time-series data and it's currently
I have a mini API that is only for an app I have built.

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.