Re: Extending SQL in C using VARIABLE length type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Carsten Kropf <ckropf2(at)fh-hof(dot)de>
Cc: Yeb Havinga <yebhavinga(at)gmail(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Extending SQL in C using VARIABLE length type
Date: 2010-02-11 15:39:04
Message-ID: 9640.1265902744@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Carsten Kropf <ckropf2(at)fh-hof(dot)de> writes:
> Thanks a lot so far. I adopted my structures and am now storing two fields (v_len_ and dimensions) and the storage is now working properly. If I now would try to combine two of these points to a range (like cube) including an upper and a lower bound n-dimensional point structure, I don't get the point how to achieve this.

Well, you can either make that a separate data type with its own
specialized functions for extracting the points, or you can make it into
an array, or possibly a composite type (record). The example code seems
to be headed towards the first of these but maybe you should consider
the alternatives.

The main problem with your example code seems to be that it's confusing
a struct with a pointer to a struct. If you made the struct members
be "struct PointND" rather than pointer to same, it would probably
work, as long as points aren't actually variable-length. Otherwise
you'd need to deal with the fact that "lower" isn't really at a fixed
offset in the larger struct.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2010-02-11 15:49:45 Re: Cache lookup failed for relation message in PG 8.3.7
Previous Message Adrian Klaver 2010-02-11 15:15:30 Re: recovering fs-data from previous installation