Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Oh, good point. Is something like PostgreSQL's array type the proper solution here then?

    create table sometable (
       id serial,
       name varchar(50),
       email text[]
    );

    This would store a list of email addresses as a single object. Or have I missed the point again?

    In other news, I'm surprised PostgreSQL doesn't have an "email_address" type. It seems to have everything else.

    • As Theory points out, you can create such a type. The problem is that if anything else needs to reference data within that type, Postgres does not allow any convenient way of doing so. This makes it pretty difficult to use Postgres for MV purposes.

      • PostgreSQL actually supports composite types.
        CREATE TYPE inventory_item AS (
            name            text,
            supplier_id     integer,
            price           numeric
        );

        CREATE TABLE on_hand (
            item      inventory_item,
            count     integer
        );

        SELECT (item).supplier_id FROM on_hand;
        It sounds like PostgreSQL even automatically makes a composite type for each table. Composite types aren't used much since they are nonstandard. They are most useful for communicating rows to user-defined functions. PostgreSQL also has user-defined types where new scalar types are defined by implementing a bunch of functions.