agora inbox for postgres@postgres.berkeley.edu  
help / color / mirror / Atom feed
From: Philip Saysell <phil@cosc.canterbury.ac.nz>
To: postgres@postgres.Berkeley.EDU
Subject: Simple arrays
Date: Wed, 7 Sep 94 02:23:06 NZS
Message-ID: <9409061423.AA03972@cosc.canterbury.ac.nz> (raw)

Suppose I have a simple array of integers defined as a type, such as
* define type int_array (element = int4, internallength = variable,
  input = array_in, output = array_out)
and I have a class set up which includes this type, such as
* create test (id = int4, array = int_array)
then can I do a 'retrieve from test' where the value, say 5, is in the
array, at an unspecified position?

What I am looking at is something like
* retrieve (test.all) where 5 is in test.array

Is this possible without having to use define operators, and loading
C functions, etc?  I have been working on the C functions for this
task for the last few days, but I am running into problems with 'link
failed!' errors when loading the C file, and not knowing the structure
of the array when it is recieved.

I am using version 4.1 of Postgres.

I have tried unsuccessfully to create a new array type using the example
of stats in section 8.5.3 of The Postgres User Manual, version 4.1
However this example is incomplete, and appears to contain some errors
(compiler does not like the `arrayp = &(stats->bytes[0]);' line, and
should it not be 'char *s' instead of 'char s' in line 3?)

Any help would be much appreciated.

Thanks,

Phil

-------------------------------------------------------------------------
Phil Saysell                     |   Home:       +64 3 358 2214
Honours Student                  |   University: +64 3 364 2555
Department of Computer Science   |   Internal:   Extention 6555
University of Canterbury         |   E-Mail: Phil@cosc.canterbury.ac.nz
CHRISTCHURCH                     |   Post:   20 Oakfield St, Burnside
NEW ZEALAND                      |            CHRISTCHURCH 5, NEW ZEALAND
-------------------------------------------------------------------------


==============================================================================
   To add/remove yourself to/from the POSTGRES mailing list: send mail with 
   the subject line ADD or DEL to "postgres-request@postgres.Berkeley.EDU"

   If this fails, send mail to "post_questions@postgres.Berkeley.EDU" and
   a human will deal with it.  DO NOT post to the "postgres" mailing list.
==============================================================================



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: postgres@postgres.berkeley.edu
  Cc: phil@cosc.canterbury.ac.nz
  Subject: Re: Simple arrays
  In-Reply-To: <9409061423.AA03972@cosc.canterbury.ac.nz>

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

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