我不知道为什么这不管用.这是关于在查询中使用两次参数的问题吗?使用PHP 7.4.33、Postgres PostgreSQL 9.6.22.
错误为:
Warning: pg_query_params(): Query failed: ERROR: inconsistent types deduced for parameter $2
LINE 11: , $2
^
DETAIL: double precision versus numeric in /home/douglass/redata/process.php on line 36
有什么问题吗?
下面是我所做的(我知道LATT/LON在行中出现了两次,一次出现在点上,一次出现在各个列中,但出于示例的目的,我想了解错误):
已创建的表:
(
unique_id numeric,
latitude numeric,
longitude numeric,
coordinates geometry(Point,4326)
);
运行PHP:
pg_query_params($connection, "
INSERT INTO test_table5
(
unique_id
, latitude
, longitude
, coordinates )
VALUES (
$1
, $2
, $3
, ST_SetSRID(ST_MakePoint( $3, $2), 4326) )
ON CONFLICT
(unique_id)
DO UPDATE SET
latitude = $2
, longitude = $3
, coordinates = ST_SetSRID(ST_MakePoint( $3, $2), 4326)",
[
50113947,
35.76673,
-78.36914
]);