Skip to content

🐛 [BUG] - postgresql date field error #2225

@worldworm

Description

@worldworm

Description

When using postgresql as a database, date fields cannot be used.
If SQLite is used, everything works fine.

Error: The "string" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date

Tested with postgresql version 17.4
Tested with undb version v1.0.0-143

Reproduction URL

No response

Reproduction steps

1. Setup with postgresql
2. Create new Table with a Date field
3. Create a new row where the date field is filled
4. -> Error
5. The row is not created

or

1. Setup with postgresql
2. Import Human Resource Management Template including data

Screenshots

Image

Image

Image

Image

Image

Image

Image

Logs

Via Frontend:

{"level":50,"time":1745541228699,"pid":8,"hostname":"undb-6c6f555967-cv8br","module":"qb","error":{},"query":"insert into \"tbl9gqk8tyddx\" (\"id\", \"fldv04tsa\", \"fldq4ob8q\", \"fld3r6sdq\", \"createdBy\", \"updatedBy\") values ($1, $2, $3, $4, $5, $6)","params":["rec0hdk7xyf","test","https://example.com/","2025-04-25T00:00:00.000Z","7runktrnhpbyk2bf","7runktrnhpbyk2bf"],"duration":1.5492030009627342,"msg":"kysely.error"}
{"level":50,"time":1745541228700,"pid":8,"hostname":"undb-6c6f555967-cv8br","module":"@undb/trpc","requestId":"800b0069-6d2a-406e-848f-80025dc663ab","responseTime":8.965158998966217,"type":"mutation","path":"record.create","error":{"code":"INTERNAL_SERVER_ERROR","name":"TRPCError"},"msg":"trpc.error: The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date"}

Via API Call:

{"level":50,"time":1745542517149,"pid":7,"hostname":"undb-6c6f555967-ndkwb","module":"qb","error":{},"query":"insert into \"tbl9gqk8tyddx\" (\"id\", \"fldv04tsa\", \"fldyf2z85\", \"fldrldmpd\", \"createdBy\", \"updatedBy\") values ($1, $2, $3, $4, $5, $6)","params":["recbvsgx6k5","Test","https://example.com","2025-04-25T00:00:00.000Z","7runktrnhpbyk2bf","7runktrnhpbyk2bf"],"duration":2.1026809999893885,"msg":"kysely.error"}
{"level":50,"time":1745542517163,"pid":7,"hostname":"undb-6c6f555967-ndkwb","module":"@undb/backend","err":{"type":"TypeError","message":"The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date","stack":"TypeError: The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date\n    at byteLength (unknown)\n    at str (/usr/src/app/node_modules/postgres/src/bytes.js:22:27)\n    at <anonymous> (/usr/src/app/node_modules/postgres/src/connection.js:938:16)\n    at forEach (native:1:11)\n    at Bind (/usr/src/app/node_modules/postgres/src/connection.js:928:16)\n    at prepared (/usr/src/app/node_modules/postgres/src/connection.js:204:7)\n    at ParameterDescription (/usr/src/app/node_modules/postgres/src/connection.js:607:58)\n    at handle (/usr/src/app/node_modules/postgres/src/connection.js:473:7)\n    at data (/usr/src/app/node_modules/postgres/src/connection.js:315:9)\n    at emit (node:events:89:22)\n    at addChunk (internal:streams/readable:265:47)\n    at readableAddChunkPushByteMode (internal:streams/readable:243:18)\n    at data (node:net:79:54)","name":"TypeError","code":"ERR_INVALID_ARG_TYPE"},"msg":"The \"string\" argument must be of type string or an instance of Buffer or ArrayBuffer. Received an instance of Date"}
{"level":30,"time":1745542517165,"pid":7,"hostname":"undb-6c6f555967-ndkwb","module":"OpenAPI","method":"POST","params":{"tableName":"Providers","baseName":"Accounts"},"query":{},"path":"/openapi/bases/Accounts/tables/Providers/records","requestId":"dd9f47dd-3f93-4f75-9188-44c582bfcf5c","msg":"openapi request"}

Browsers

Chrome, Firefox

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