Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Can's set zero precision to timestamp #4784

@6aKa

Description

@6aKa

Environment

Knex version: Knex Local version: 0.95.12
Database + version: psql (PostgreSQL) 13.4
OS: MacOS Monterey 12.0.1 (21A559)

Bug

In migration create field
t.timestamp('confirmed_at', {useTz: false, precision: 0});

     Column      |            Type             | Collation | Nullable |      Default      | Storage  | Stats target | Description
-----------------+-----------------------------+-----------+----------+-------------------+----------+--------------+-------------
 confirmed_at    | timestamp without time zone |           |          |                   | plain    |              |

Expected timestamp(0) without time zone

From PostgreSQL documentation

time, timestamp, and interval accept an optional precision value p which specifies the number of fractional digits retained in the seconds field. By default, there is no explicit bound on precision. The allowed range of p is from 0 to 6 for the timestamp and interval types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions