actor.usr_address

Deferrable Constraints: The following FK constraints are deferrable — they are checked at transaction end, not statement end: usr_address_replaces_fkey, usr_address_usr_fkey.

Trigger Side Effects: Writing to this table automatically triggers writes to other tables:

Columns

Column Type Nullable Default Notes

id PK

integer

No

nextval('actor.usr_address_id_seq'::regclass)

valid

boolean

No

true

within_city_limits

boolean

No

true

address_type

text

No

'MAILING'::text

usr FK

integer

No

actor.usr(id)

street1

text

No

street2

text

Yes

city

text

No

county

text

Yes

state

text

Yes

country

text

No

post_code

text

No

pending

boolean

No

false

replaces FK

integer

Yes

actor.usr_address(id)

Primary Key

(id)

Foreign Keys

Column(s) References On Delete On Update Deferrable Constraint

replaces

actor.usr_address(id)

NO ACTION

NO ACTION

DEFERRED

usr_address_replaces_fkey

usr

actor.usr(id)

NO ACTION

NO ACTION

DEFERRED

usr_address_usr_fkey

Indexes

Index Method Definition

usr_address_pkey PK

btree

CREATE UNIQUE INDEX usr_address_pkey ON actor.usr_address USING btree (id)

actor_usr_addr_city_idx

btree

CREATE INDEX actor_usr_addr_city_idx ON actor.usr_address USING btree (lowercase(city))

actor_usr_addr_post_code_idx

btree

CREATE INDEX actor_usr_addr_post_code_idx ON actor.usr_address USING btree (lowercase(post_code))

actor_usr_addr_state_idx

btree

CREATE INDEX actor_usr_addr_state_idx ON actor.usr_address USING btree (lowercase(state))

actor_usr_addr_street1_idx

btree

CREATE INDEX actor_usr_addr_street1_idx ON actor.usr_address USING btree (lowercase(street1))

actor_usr_addr_street2_idx

btree

CREATE INDEX actor_usr_addr_street2_idx ON actor.usr_address USING btree (lowercase(street2))

actor_usr_addr_usr_idx

btree

CREATE INDEX actor_usr_addr_usr_idx ON actor.usr_address USING btree (usr)

Triggers

Trigger Timing Event Level Function

audit_actor_usr_address_update_trigger

AFTER

DELETE OR UPDATE

ROW

auditor.audit_actor_usr_address_func()

Trigger Bodies

audit_actor_usr_address_update_trigger

Function: auditor.audit_actor_usr_address_func()
Timing: AFTER DELETE OR UPDATE ROW

        BEGIN
            INSERT INTO auditor.actor_usr_address_history ( audit_id, audit_time, audit_action, audit_user, audit_ws, id, valid, within_city_limits, address_type, usr, street1, street2, city, county, state, country, post_code, pending, replaces )
                SELECT  nextval('auditor.actor_usr_address_pkey_seq'),
                    now(),
                    SUBSTR(TG_OP,1,1),
                    eg_user,
                    eg_ws,
                    OLD.id, OLD.valid, OLD.within_city_limits, OLD.address_type, OLD.usr, OLD.street1, OLD.street2, OLD.city, OLD.county, OLD.state, OLD.country, OLD.post_code, OLD.pending, OLD.replaces
                FROM auditor.get_audit_info();
            RETURN NULL;
        END;

Referenced By

The following tables have foreign keys pointing to actor.usr_address (3 referencing table(s)):

Table Referencing Column(s) Referenced Column(s) Constraint

actor.usr

billing_address

id

actor_usr_billing_address_fkey

actor.usr

mailing_address

id

actor_usr_mailing_address_fkey

actor.usr_address

replaces

id

usr_address_replaces_fkey