[SQL] Re: RE: Create table in functions
On Thu, 31 Aug 2000, Jan Wieck wrote: First of all thank you very much for your effort! This is definitely a good argument for PostgeSQL to have such fast support in adding features which might convince some of my collegues or my boss :). > Could you try out the current CVS sources? Well, I walked around the problem and I'm affrais I don't want to use the CVS tree in a production environment. Moreover I have very poor bandwith and I'm sitting behind a CVS disabled firewall :(. So I have problems to check it soon. May be I coudl try a patch against 7.0.2 sources if this would not make much trouble. I definitely will honor your effort by testing it but I can't do this in the next weeks! > I've added an EXECUTE keyword to PL/pgSQL earlier - er - > yesterday. It should give you the power to at least port the > proc below to PostgreSQL. Hopefully some other PostgreSQL users besides me will love you for that . Kind regards Andreas.
[SQL] Query-ing arrays
Stupid FAQ probably:
Is it possible to query an array for an item WITHOUT KNOWING where in the
array the item might be held?
For example, I have a tbale with the following character array:
> category char(3)[],
I would like to find all records in which 'category' contains an array
element of a certain type, like maybe 'xxx' for instance. So, for a
particular record, 'category' may be set to '{'gfe','qwe','xcs','xxx'}'
I cannot do:
SELECT * FROM blah WHERE category[4]='xxx';
because I do not know that the 'xxx' will always be in the 4th position.
Suggestions? TIA, Jon
--
-**-*-*---*-*---*-*---*-*-*-*---*-*---*-*-*-*-*---
Jon Lapham
Centro Nacional de Ressonancia Magnetica Nuclear de Macromoleculas
Universidade Federal do Rio de Janeiro (UFRJ) - Brasil
email: [EMAIL PROTECTED]
***-*--**---***---
Re: [SQL] Query-ing arrays
I'd suggest checking the array utilities in contrib. I believe
it has functions/operators for element in set.
Stephan Szabo
[EMAIL PROTECTED]
On Fri, 1 Sep 2000, Jon Lapham wrote:
> Stupid FAQ probably:
>
> Is it possible to query an array for an item WITHOUT KNOWING where in the
> array the item might be held?
>
> For example, I have a tbale with the following character array:
> > category char(3)[],
>
> I would like to find all records in which 'category' contains an array
> element of a certain type, like maybe 'xxx' for instance. So, for a
> particular record, 'category' may be set to '{'gfe','qwe','xcs','xxx'}'
>
> I cannot do:
> SELECT * FROM blah WHERE category[4]='xxx';
> because I do not know that the 'xxx' will always be in the 4th position.
Re: [SQL] Query-ing arrays
On Fri, Sep 01, 2000 at 09:07:35AM -0700, Stephan Szabo wrote: > > I'd suggest checking the array utilities in contrib. I believe > it has functions/operators for element in set. Thanks, that looks like exactly what I need. I wonder if someone could put a reference to this array utility package in the manual, chapter 8, on arrays. Maybe something like this: For more complex work with arrays, see Massimo Dal Zotto's contrib package 'array_iterator'. This loadable module "...defines a new class of functions which take an array and a scalar value, iterate a scalar operator over the elements of the array and the value, and compute a result as the logical OR or AND of the iteration results." -- -**-*-*---*-*---*-*---*-*-*-*---*-*---*-*-*-*-*--- Jon Lapham Centro Nacional de Ressonancia Magnetica Nuclear de Macromoleculas Universidade Federal do Rio de Janeiro (UFRJ) - Brasil email: [EMAIL PROTECTED] ***-*--**---***---
