Page 1 of 1

Postgresql, timestamp and EF

Posted: Tue 09 Jun 2015 13:49
by damon.cognito
I've noticed that EF does not seem to handle the precision of a PostgreSQL timestamp. If you have a 'timestamp(x) with time zone' (where x is 0 to 6) this is imported as a 'timestamp with time zone'. This does cause some issues when the field is marked as concurrency mode, but the main issue is when we use the 'create script from model' option, it returns the wrong type of timestamp. A simple test database follows:

Code: Select all

CREATE DATABASE test WITH TEMPLATE = template0 ENCODING = 'LATIN1' LC_COLLATE = 'C' LC_CTYPE = 'C';

Code: Select all

-- Dumped from database version 9.3.5
ALTER DATABASE test OWNER TO postgres;

SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'LATIN1';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

CREATE DATABASE test WITH TEMPLATE = template0 ENCODING = 'LATIN1' LC_COLLATE = 'C' LC_CTYPE = 'C';
CREATE EXTENSION IF NOT EXISTS plpgsql WITH SCHEMA pg_catalog;
COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural language';

SET search_path = public, pg_catalog;
SET default_tablespace = '';
SET default_with_oids = false;

CREATE TABLE atable (
    column1 timestamp with time zone,
    column2 timestamp(0) with time zone
);
ALTER TABLE public.atable OWNER TO postgres;

REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
Regards, Damon.

Re: Postgresql, timestamp and EF

Posted: Fri 12 Jun 2015 17:03
by Shalex
Thank you for your report. We are processing your request.

Re: Postgresql, timestamp and EF

Posted: Mon 15 Jun 2015 12:48
by Shalex
damon.cognito wrote:If you have a 'timestamp(x) with time zone' (where x is 0 to 6) this is imported as a 'timestamp with time zone'.
We have reproduced the case and are investigating the question.
damon.cognito wrote:This does cause some issues when the field is marked as concurrency mode
We have just sent a test project to the email address specified in your forum profile. The concurrency mode with a property which corresponds to the 'timestamp(6) with time zone' column works as expected. Please modify it for reproducing the bug and send it back to us.

Re: Postgresql, timestamp and EF

Posted: Tue 23 Jun 2015 22:38
by damon.cognito
This has been done. Cheers!

Re: Postgresql, timestamp and EF

Posted: Thu 02 Jul 2015 14:57
by Shalex
The behaviour is changed in the new (7.3.447) build of dotConnect for PostgreSQL: now Entity Developer and EDM Wizard take into account precision of the timestamp columns in Model First / Database First approaches.