You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Fields with the datatype 'interval' do not show up in the table component. #721
-- bug.sqlSELECT'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
Expected behavior
Showing normal values.
Version information
OS: Running Docker (postgres:17.2-bookworm) on macOS (Apple M3)
But with this version v0.31.0 I at least get an ERROR in the console.
[2024-12-02T13:18:45.886Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 6
[2024-12-02T13:18:45.886Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 6
[2024-12-02T13:18:45.906Z INFO actix_web::middleware::logger] 127.0.0.1 "GET /bug.sql HTTP/1.1" 200 2142 "-" "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.027387
You seem to have tested it on v0.32.0, if that all works, I will just wait till that version is available.
[2025-07-07T08:54:52.244Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 6
[2025-07-07T08:54:52.244Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 5
[2025-07-07T08:54:52.244Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 2 bytes from index 5
[2025-07-07T08:54:52.244Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 5
select 'table' as component;
select '00:00:00'::interval;
select '1 day 2 hours'::interval;
select age(CURRENT_TIMESTAMP, '2024-07-11T00:09:00+00:00'::timestamp);
select age(CURRENT_TIMESTAMP, '2024-10-25 00:09:12.000000'::timestamp);
works perfectly.
SELECT
age(CURRENT_TIMESTAMP, created) AS age
FROM
issue
WHERE
assignee = 'Gus.Power'
also works perfectly.
SELECT
age(CURRENT_TIMESTAMP, created) AS age
FROM
issue
WHERE
assignee = $person
breaks!
[2025-07-07T10:06:10.219Z ERROR sqlpage::webserver::database::sql_to_json] Failed to decode alloc::string::String value: invalid utf-8 sequence of 1 bytes from index 5
CREATE TEMP TABLE IF NOT EXISTS issue AS
SELECT '1' AS issue_id,
'2024-07-11 00:09:00.000000'::timestamp AS created;
SELECT 'table' AS component;
-- WORKS
SELECT * FROM issue;
-- WORKS
SELECT
issue_id AS id,
age(CURRENT_TIMESTAMP, created) AS age
FROM
issue;
-- BROKEN - call url using ?issue_id=1
SELECT
issue_id AS id,
age(CURRENT_TIMESTAMP, created) AS age
FROM
issue
WHERE
issue_id = $id;
$ cat tests/end-to-end/fixtures/repro_721/index.sql
SELECT 'table' AS component;
SELECT 'static' AS query, '1 day 02:03:04'::interval AS duration;
SELECT 'with a variable' AS query, '1 day 02:03:04'::interval AS duration, $unused AS unused;
$ cat tests/end-to-end/fixtures/repro_721/test.ts
import { expect, test } from "../../fixture.ts";
test("interval values show with and without a variable in the query", async ({ page }) => {
const durations = page.locator("tbody tr td:nth-child(2)");
await expect(durations).toHaveText(["1 day 02:03:04", "1 day 02:03:04"]);
});
$ nix run .#reproduce -- repro_721 --versions v0.35.0,v0.36.1,tree --databases postgres
repro_721
version
postgres
v0.35.0
✘ 1 of 1 failed. interval values show with and without a variable in the query: expected "1 day 02:03:04", received ""
v0.36.1
✔ 1 passed
tree
✔ 1 passed
On commit 9ac0a27: nix run .#reproduce -- repro_721 --versions v0.35.0,v0.36.1,tree --databases postgres
Activity
lovasoa commentedon Dec 2, 2024
Hello and welcome to sqlpage !
I cannot reproduce this issue. Could you please upgrade to the latest release and confirm whether you still observe this behavior ?
rempargo commentedon Dec 2, 2024
I did a
brew upgrade sqlpage(didn't realise I installed sqlpage through brew).
I got now version
v0.31.0Still the same behaviour.
Also with the binary from https://github.com/sqlpage/SQLPage/releases/download/v0.31.0/sqlpage-macos.tgz
I get the same behaviour
But with this version
v0.31.0I at least get an ERROR in the console.You seem to have tested it on
v0.32.0, if that all works, I will just wait till that version is available.add a test for #721
lovasoa commentedon Dec 2, 2024
Indeed, I can reproduce the issue in v0.31
but not in 0.32
I'm going to mark this issue as fixed.
You can download pre-release versions if you need them, the easiest is to use the
lovasoa/sqlpage:mainimage on docker.guspoweraa commentedon Jul 7, 2025
I am seeing this on mac using v0.35.2:
lovasoa commentedon Jul 7, 2025
Can you share a reproduction of the issue ? Does a simple
trigger the issue ?
guspoweraa commentedon Jul 7, 2025
OK so this is really wild:
works perfectly.
also works perfectly.
breaks!
lovasoa commentedon Jul 7, 2025
Ok, can you make a minimal version that will be easy for me to reproduce? Maybe adding a
create temp table if not existsand aset person =on top?guspoweraa commentedon Jul 7, 2025
lovasoa commentedon Jul 7, 2025
Ok, I can reproduce it. Let me reopen this issue !
Postgres returns textual interval representations for static queries, and binary values for parametrized queries.
Until we fix this, you will have to manually convert values to strings before returning them to sqlpage:
guspoweraa commentedon Jul 7, 2025
Oh wow nicely done!
That is pretty wild!
Easy workaround - thank you @lovasoa !
81reap commentedon Oct 29, 2026
I think this issue is fixed as of SQLPage v0.36.1
reproduction
repro_721
On commit 9ac0a27:
nix run .#reproduce -- repro_721 --versions v0.35.0,v0.36.1,tree --databases postgres