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.

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

      You can create one easily enough with a CREATE DOMAIN statement. Here's a naive implementation:

      CREATE DOMAIN email_address AS TEXT
      CONSTRAINT ck_email_address CHECK (
         VALUE ~ '^[^@]+@[^@]+$'
      );

      Modify the regular expression as needed to increase its accuracy. Then you can use it like any other PostgreSQL data type:

      CREATE TABLE person (
        id SERIAL PRIMARY KEY,
        name text,
        email email_address
      );