Database Reference
In-Depth Information
In the end, we need to create the supporting trigger in the following manner:
warehouse_db=# CREATE TRIGGER sales_day_trigger
BEFORE INSERT ON sales_record_listpart
FOR EACH ROW
EXECUTE PROCEDURE sales_record_list_insert();
You can verify that the partition is linked with the master table using the
following command:
warehouse_db=# \d+ sales_record_listpart
Table "sales_record_listpart"
Column | Type | Modifiers | Storage
--------------+---------+-----------+----------
id | numeric | not null | main
sales_date | date | | plain
sales_amount | numeric | | main
city | text | | extended
Indexes:
"sales_record_listpart_pkey" PRIMARY KEY, btree (id)
Triggers:
Sales_day_trigger BEFORE INSERT ON sales_record_listpart
FOR EACH ROW EXECUTE PROCEDURE sales_record_list_insert()
Child tables: sales_record_list1,
sales_record_list2
Has OIDs: no
The preceding output is a partial output of the \d+ command
Now, let's do some quick inserts and verify that our list partition is also working
how we expect it do so:
warehouse_db=# INSERT INTO sales_record_listpart
(id, sales_date, sales_amount, city)
VALUES
(1,'15-APR-2008',1200,'sydney');
warehouse_db=# INSERT INTO sales_record_listpart
(id, sales_date, sales_amount, city)
VALUES
(2,'15-APR-2008',1500,'Boston');
warehouse_db=# INSERT INTO sales_record_listpart
(id, sales_date, sales_amount, city)
VALUES
 
Search WWH ::




Custom Search