Re: Test for array slice?

From: Joe Conway <mail(at)joeconway(dot)com>
To: Peter Fein <pfein(at)pobox(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Test for array slice?
Date: 2005-06-03 16:32:40
Message-ID: 42A08628.6010001@joeconway.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Peter Fein wrote:
> I want to do something like this (pardon my pseudocode):
>
> A=ARRAY[4, 5, 6, 7, 8]
> B=ARRAY[5, 6]
>
> is_sliceof(A, B), i.e., there exists a slice of A that equals B. My
> best thought ATM is to convert both to strings and use pattern matching
> - any better ideas?

I can't think of a really good way to do that directly in Postgres, but
I'd bet (still not sure though) there is a way in R.
http://www.r-project.org/index.html
If so, you could use PL/R:
http://www.joeconway.com/plr/

HTH,

Joe

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Sean Davis 2005-06-03 17:06:39 Re: Test for array slice?
Previous Message David Fetter 2005-06-03 16:30:46 Re: PostgreSQL Developer Network