Thread
-
BUG #15716: pgadmin 4.3: row_to_json error
PG Bug reporting form <noreply@postgresql.org> — 2019-03-26T15:18:07Z
The following bug has been logged on the website: Bug reference: 15716 Logged by: Jan Magnusson Email address: jan.magnusson0@gmail.com PostgreSQL version: 11.2 Operating system: windows 10 pro Description: The row_to_json() function does not produce any output data, only message. b.r. Jan ------------------------------------------------------------------------------------ CREATE SCHEMA testing AUTHORIZATION postgres; CREATE TABLE testing.batch ( batch_id integer NOT NULL, max_record integer, record_count integer, creation_ts timestamp without time zone DEFAULT now(), CONSTRAINT batch_id_pkey PRIMARY KEY (batch_id) ) WITH ( OIDS = FALSE ) TABLESPACE pg_default; insert into testing.batch values(1, now(), 0, 0); insert into testing.batch values(2, now(), 1, 1); select row_to_json(row(batch_id)) from testing.batch; or select row_to_json(b) from (select * from testing.batch) b; They only produce the following message, but no output: Successfully run. Total query runtime: 70 msec. 2 rows affected. Other client output of the latter: {"batch_id":1,"max_record":0,"record_count":0,"creation_ts":"2019-03-26T16:44:34.338218"} {"batch_id":2,"max_record":1,"record_count":1,"creation_ts":"2019-03-26T16:51:33.196218"} -
Re: BUG #15716: pgadmin 4.3: row_to_json error
Anthony Sotolongo <asotolongo@gmail.com> — 2019-03-26T15:49:20Z
hi, I think your mistake is in the order of the insert clause use: insert in the values of testing.batch (1,0, 0, now ()); instead:insert into testing.batch values(1, now(), 0, 0); can you test with this order? i test and function well postgres=# CREATE SCHEMA testing AUTHORIZATION postgres; CREATE SCHEMA postgres=# CREATE TABLE testing.batch postgres-# ( postgres(# batch_id integer NOT NULL, postgres(# max_record integer, postgres(# record_count integer, postgres(# creation_ts timestamp without time zone DEFAULT now(), postgres(# CONSTRAINT batch_id_pkey PRIMARY KEY (batch_id) postgres(# ) postgres-# WITH ( postgres(# OIDS = FALSE postgres(# ) postgres-# TABLESPACE pg_default; CREATE TABLE postgres=# insert into testing.batch values(1,0 , 0,now()); INSERT 0 1 postgres=# insert into testing.batch values(2, 1, 1, now()); INSERT 0 1 postgres=# select row_to_json(row(batch_id)) from testing.batch; row_to_json ------------- {"f1":1} {"f1":2} (2 filas) postgres=# select row_to_json(b) postgres-# from (select * from testing.batch) b; row_to_json ------------------------------------------------------------------------------------------- {"batch_id":1,"max_record":0,"record_count":0,"creation_ts":"2019-03-26T12:45:42.598815"} {"batch_id":2,"max_record":1,"record_count":1,"creation_ts":"2019-03-26T12:45:43.885679"} (2 filas) postgres=# select version(); version --------------------------------------------------------------------------------------------------------------------------------------------- PostgreSQL 11.2 (Ubuntu 11.2-1.pgdg16.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 5.4.0-6ubuntu1~16.04.11) 5.4.0 20160609, 64-bit (1 fila) postgres=# regards El 26-03-19 a las 12:18, PG Bug reporting form escribió: > The following bug has been logged on the website: > > Bug reference: 15716 > Logged by: Jan Magnusson > Email address: jan.magnusson0@gmail.com > PostgreSQL version: 11.2 > Operating system: windows 10 pro > Description: > > The row_to_json() function does not produce any output data, only message. > > b.r. Jan > ------------------------------------------------------------------------------------ > CREATE SCHEMA testing AUTHORIZATION postgres; > > CREATE TABLE testing.batch > ( > batch_id integer NOT NULL, > max_record integer, > record_count integer, > creation_ts timestamp without time zone DEFAULT now(), > CONSTRAINT batch_id_pkey PRIMARY KEY (batch_id) > ) > WITH ( > OIDS = FALSE > ) > TABLESPACE pg_default; > > > insert into testing.batch values(1, now(), 0, 0); > insert into testing.batch values(2, now(), 1, 1); > > select row_to_json(row(batch_id)) from testing.batch; > > or > > select row_to_json(b) > from (select * from testing.batch) b; > > They only produce the following message, but no output: > > Successfully run. Total query runtime: 70 msec. > 2 rows affected. > > Other client output of the latter: > > {"batch_id":1,"max_record":0,"record_count":0,"creation_ts":"2019-03-26T16:44:34.338218"} > {"batch_id":2,"max_record":1,"record_count":1,"creation_ts":"2019-03-26T16:51:33.196218"} >