Say I have the following schema for my Postgres database:
CREATE TABLE sources (
source TEXT NOT NULL,
PRIMARY KEY (source)
);
CREATE TABLE ipaddrs (
addr INET
) INHERITS (source):
CREATE TABLE domains (
domain TEXT
) INHERITS (source);
Is it possible for me to use a CHECK
constraint somewhere that would add a source
that is a valid IP address to the ipaddrs
partition, and otherwise add it to the domains
partition?
Ultimately, I’m wanting to be able to leverage Postgres’ built-in INET/CIDR capabilities on sources that are IP addresses.