nette/database

Wrong type detection in PostgreSQL

Closed this issue · 1 comments

  • bug report? yes
  • feature request? no
  • version: v2.4.1

Description

Data type detection does not accept all postgres supported timestamp types as "time" types. Here, postgres type "TIMESTAMP WITH TIME ZONE" is interpreted as string.

Steps To Reproduce

Create a table with two columns "TIMESTAMP" and "TIMESTAMP WITH TIME ZONE". Insert a record and compare the results in ActiveRow object -- the first column will be OK, the second will be string.

Fix is simple -- update Helpers.php as follows:
Changing the $typePatterns array on line with '(SMALL)?DATETIME(OFFSET)?\d*|TIME(STAMP)?' by adding .* after "STAMP".

Thank you @dg