PostgreSQL interval type

Issue #460 resolved
Former user created an issue

I got an error trying to use sqlalchemy with an existing PostgreSQL 8.1 database. Postgres provides a rather unusual type: 'interval' (see http://www.postgresql.org/docs/8.2/interactive/datatype-datetime.html) which psycopg2 translates to a datetime.timedelta object.

I've looked at sqlalchemy.types and sqlalchemy.databases.postgres but it seems no code handles such a data type.

Comments (7)

  1. Former user Account Deleted
    • changed status to open
    • removed status

    Despite the fact PostgreSQL has only one interval data type, it supports SQL92 syntax which has two distinct interval data types.

    INTERVAL YEAR [(year_precision)]((year_precision)) TO MONTH
    
    INTERVAL DAY [(day_precision)]((day_precision)) 
       TO SECOND [(fractional_seconds_precision)]((fractional_seconds_precision))
    

    If column was created using ISO syntax, its type stored as 'interval year to month' or 'interval day to second' which sqlalchemy doesn't recognize.

  2. Log in to comment