"Field not found" error in simple queries with PostgreSQL
Original Reporter info from Mantis: altanbozoglu
-
Reporter name: Altan Bozoglu
Original Reporter info from Mantis: altanbozoglu
- Reporter name: Altan Bozoglu
Description:
The connection with lazarus and the database server is successful, but even in simple queries, postgresql throws a "field not found" error. The error is TDataSet.BindFields (Binding: Boolean); when it is called. The BindFields procedure is in dataset.inc. Unfortunately, debugging with lazarus cannot go any further.
Steps to reproduce:
Create any table and add fields.
Then call the data with a simple SQL statement.
Hostname: 212.237.21.177
port: 5432
Database: testdatabase
UserName: lovefreepascal
Password: r8vwQSKye23tjUzg
CREATE TABLE public.testtable
(
id bigserial NOT NULL,
field_string character varying(50),
field_integer integer,
field_double double precision,
field_boolean boolean,
PRIMARY KEY (id)
)
WITH (
OIDS = FALSE
);
ALTER TABLE public.testtable
OWNER to lovefreepascal;
INSERT INTO public.testtable(
field_string, field_integer, field_double, field_boolean)
VALUES ('bla bla bla', 911, 3.14, true);
In Lazarusa, use your favorite db library to link to the database. (I'm using zeoslib but that doesn't matter) Make the connection and run the following SQL statement.
(select * from testtable)
You should now see the run-time error.
"xxxxx field not found"
Additional information:
I use lazarus 2.0.6 on ubuntu desktop 18.04.3 64-bit
fpc 3.0.4
lazarus 2.0.6
Test Server : Ubuntu Linux 14.04.5 kernel: Linux 4.4.0-148-generic on x86_64
PostgreSQL 10.8 (Ubuntu 10.8-1.pgdg14.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 4.8.4-2ubuntu1~14.04.4) 4.8.4, 64-bit
Mantis conversion info:
- Mantis ID: 36340
- OS: ubuntu desktop
- OS Build: 18.04.3
- Build: 1
- Platform: 64-bit
- Version: 3.0.4