arkhipov / temporal_tables

Temporal Tables PostgreSQL Extension
BSD 2-Clause "Simplified" License
937 stars 47 forks source link

Got an error when I have a table with an array column #8

Closed gstoffer closed 8 years ago

gstoffer commented 9 years ago

CONFIGS : PostgreSQL 9.4 Temporal_tables 1.0.2

Hi,

I have an issue when I use a versioned table contains an array column like this :

CREATE TABLE example ( id serial PRIMARY KEY, name text, url text, enabled boolean DEFAULT true, tags text[], sys_period tstzrange NOT NULL DEFAULT tstzrange(current_timestamp, null) );

CREATE TABLE example_history (LIKE example);

CREATE TRIGGER versioning_example_trigger BEFORE INSERT OR UPDATE OR DELETE ON example FOR EACH ROW EXECUTE PROCEDURE versioning('sys_period', 'example_history', true);

INSERT INTO example VALUES (DEFAULT, 'john', 'http://www.example.com', true, ARRAY['doe', 'John'], DEFAULT);

DELETE FROM example WHERE id = 1;

When I DELETE on this table I got this error : column "tags" of relation "example" is of type text[] but column "tags" of history relation "example_history" is of type text[]

regards,

Guillaume STOFFER

arkhipov commented 9 years ago

Hello, @gstoffer.

The issue you are encountering was already reported on the PostgreSQL mailing list on July 7, 2015. I am not sure if there has been any progress since then, but it might be a good idea to ask them.

As a workaround, you can create the history table without using LIKE/AS.

gstoffer commented 9 years ago

Hello,

Many thanks for the answer and the workaround. :-)

gstoffer commented 8 years ago

Hello,

As this is not a bug in your project, I close this ticket.

Regards :-)