Skip to content

Fields with the datatype 'interval' do not show up in the table component. #721

Open
@rempargo

Description

@rempargo

Introduction

Fields with the datatype 'interval' do not show up in the table component.
For some values, it shows unexpected characters

To Reproduce

Just a very simple table with id and interval column and some test data.

BEGIN;
CREATE TABLE "public"."sqlpage_bugs" (
    "id" int4 NOT NULL DEFAULT nextval('sqlpage_bugs_id_seq'::regclass),
    "my_interval" interval DEFAULT '00:00:00'::interval,
    PRIMARY KEY ("id")
);
COMMIT;

BEGIN;
CREATE SEQUENCE IF NOT EXISTS sqlpage_bugs_id_seq;
COMMIT;

BEGIN;
INSERT INTO "public"."sqlpage_bugs" ("my_interval")
VALUES 
    ('0'),
    ('1'),
    ('2'),
    ('3'),
    ('4');
COMMIT;

The sql needed for sqlpage

-- bug.sql
SELECT 
    'table'               AS component, 
SELECT
    id as id,
    my_interval as my_interval,
    FROM sqlpage_bugs;

Actual behavior

The listed table in the browser got none or strange characters in the my_interval (with datatype 'interval' column, even though the table got real values in this column.

No sqlpage errors

[2024-12-02T10:35:58.333Z INFO  actix_web::middleware::logger] 127.0.0.1 "GET /bug.sql HTTP/1.1" 200 2371 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36" 0.002695

Screenshots

my_sql

Expected behavior

Showing normal values.

Version information

  • OS: Running Docker (postgres:17.2-bookworm) on macOS (Apple M3)
  • Database [Postgres 17.2]
  • SQLPage Version : 0.30.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions