Hello Lucas,

the use case is I want to store typed metadata, e.g. numbers, strings, 
boolean and geolocation, like this:

CREATE TYPE meta.metadata_type AS ENUM ('int32', 'float64', 'string', 
'lnglat', 'boolean');

CREATE TABLE meta.metadata (
    uuid                 uuid  NOT NULL,
    reference_uuid       uuid  NOT NULL,
    datetime             timestamptz NOT NULL,
    type                 meta.metadata_type  NOT NULL,
    key                  varchar(128) NOT NULL,
    CONSTRAINT pk_metadata_id PRIMARY KEY ( uuid )
);

CREATE TABLE meta.metadata_int32 (
    value            integer NOT NULL
) INHERITS (meta.metadata);

CREATE TABLE meta.metadata_float64 (
    value            double precision NOT NULL
) INHERITS (meta.metadata);

CREATE TABLE meta.metadata_string (
    value            varchar(255) NOT NULL
) INHERITS (meta.metadata);

CREATE TABLE meta.metadata_lnglat (
    value            GEOGRAPHY(POINT) NOT NULL
) INHERITS (meta.metadata);

CREATE TABLE meta.metadata_boolean (
    value            boolean NOT NULL
) INHERITS (meta.metadata);

This is in order to be able to build more intelligent and performant 
queries for certain types of metadata. I hope the idea becomes clear.

- David


On Wednesday, July 11, 2018 at 8:33:51 PM UTC+2, Lukas Eder wrote:
>
> Hello David,
>
> I'm assuming you plan to be using the code generator, which unfortunately 
> does not support PostgreSQL table inheritance yet. There are a few pending 
> feature requests:
> - https://github.com/jOOQ/jOOQ/issues/2777
> - https://github.com/jOOQ/jOOQ/issues/2782
>
> Also related: Oracle OBJECT type inheritance:
> - https://github.com/jOOQ/jOOQ/issues/644
>
> This topic simply hasn't seen much traction in the past, compared to the 
> complexity it would introduce to jOOQ's type system.
>
> What's the use-case you're covering with PostgreSQL table inheritance?
>
> Am Mi., 11. Juli 2018 um 16:21 Uhr schrieb <[email protected] <javascript:>
> >:
>
>> Hello,
>>
>> I have a postgres table with inheritance, I want to write a DAO for, 
>> which I want to derive from DAOImpl. Now DAOImpl expects the table to be 
>> of type UpdatetableRecord: DAOImpl<R extends UpdatableRecord<R>, P, T>. 
>> What would be the best way to implement a class working on an inherited 
>> table with jOOQ?
>>
>

-- 
You received this message because you are subscribed to the Google Groups "jOOQ 
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to