Skip to content

assure row and column types #4

@burner

Description

@burner

One issue I faced a few times is that the result of the query changes when tables used to compute the results changed.

It would be awesome to catch those issues before the application layer fails to parse the data.

Just a brainstorm

SELECT 
  A.id        -- type: bigint
  B.name -- type: text
  B.date   -- type: date
FROM A
INNER JOIN B ON A.id = B.id

should B.date be changed to DateTime regresql should tell me that the expected type of B.date is not date but DateTime.

edit:
This is even more useful when returning json

SELECT json_build_object
 (  'id' ,A.id        -- type: bigint
 , 'name', B.name -- type: text
 , 'date', B.date   -- type: date
) AS rslt
FROM A
INNER JOIN B ON A.id = B.id

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