jakajancar / pgc4d

A full-featured PostgreSQL Client for Deno
MIT License
21 stars 3 forks source link

pcg4d Incorrectly Expects a Number #12

Closed ebebbington closed 3 years ago

ebebbington commented 3 years ago
console.log(query)
console.log(args)
await db.query(query, args);

Results in:

realworld_drash | INSERT INTO articles  (author_id, title, description, body, slug, created_at, updated_at, tags) VALUES ($1, $2, $3, $4, $5, to_timestamp($6), to_timestamp($7), $8);
realworld_drash | [
realworld_drash |   1,
realworld_drash |   "h",
realworld_drash |   "rr",
realworld_drash |   "gf",
realworld_drash |   "h",
realworld_drash |   "1606588903.871",
realworld_drash |   "1606588903.871",
realworld_drash |   "dd"
realworld_drash | ]
realworld_drash | AssertionError: Error sending param $6: Expected number, got string
realworld_drash |     at assert (asserts.ts:149:11)
realworld_drash |     at data_type_converters.ts:45:13

But this is the articles data structure:

--
-- Name: articles; Type: TABLE; Schema: public; Owner: user
--

CREATE TABLE public.articles (
    id integer NOT NULL,
    author_id integer NOT NULL,
    title character varying(255) NOT NULL,
    description character varying(255) NOT NULL,
    body character varying(255) NOT NULL,
    slug character varying(255) NOT NULL,
    created_at timestamp without time zone NOT NULL,
    updated_at timestamp without time zone NOT NULL,
    tags character varying(255)
);
ebebbington commented 3 years ago

nvm, i'm an idiot, the timestamp needs to be a number :D