pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Spirou <spirou@carolo.net>
To: pgsql-interfaces <pgsql-interfaces@postgreSQL.org>
Subject: PgAccess and arrays
Date: Wed, 11 Aug 1999 07:23:23 +0200
Message-ID: <37B108CB.842CC5C7@carolo.net> (raw)
References: <37AD4E21.DFDF72A8@flex.ro>

It seems that pgAccess has as much trouble as I have with arrays ...
and perhaps more since I can't even run the queries below in it.

Does anyone have information on those damned arrays ?

Here is the text of a message I have posted on NOVICE
without success up to now.

********************************

I'd like to make some selections on values in arrays.
I know I could use a more 'SQL-correct' way to achieve this.
(create another table, link it to the first one and so on.)
But I was playing with arrays and I was wondering ... 

I give an exemple to make my question clear (I hope)

let's say I store some values in a 2 dim array :

        create table myfunction (
                id      int4,
                name    text,
                args    text[][]);

        insert into myfunction
        values( 1,
                'func1',
                '{{"key1", "value1"}, {"key2", "value2"}}');
 
        insert into myfunction
        values( 2,
                'func2',
                '{{"key1", "value1"}, {"key2", "value5"}, {"key3",
"value2"}}');
 
everything's OK.

I can store my values.
I can retrieve them :
        select args from myfunction where name = 'func1';
or
        select myfunction.args[1][2] where id = 2;
or even
        select myfunction.args[1:1][1:2] where id = 2;
with some trial & errors it works.

But I can't manage to look into myfunction.args,
I mean something like
        select name from myfunction 
        where myfunction.args [][2] = 'value2';
or
        select name from myfunction 
        where myfunction.args ~~ '%value2%';
if I don't know where is value2 in my array (if it exists).
 
Which operators can I use ?
How can I inspect an array-field ?

Any information on arrays would be welcome.


-- 
Spirou
Un club Linux pour les Carolos -->
http://carolo.net/carolinux/index.html



Message-ID: <37B108CB.842CC5C7@carolo.net>
Permalink:  ../37B108CB.842CC5C7@carolo.net/
Also on:    postgresql.org/message-id/37B108CB.842CC5C7@carolo.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: spirou@carolo.net
  Subject: Re: PgAccess and arrays
  In-Reply-To: <37B108CB.842CC5C7@carolo.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox