]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#3294] fix reservation-del psql query
authorPiotrek Zadroga <piotrek@isc.org>
Wed, 17 Apr 2024 12:22:34 +0000 (14:22 +0200)
committerPiotrek Zadroga <piotrek@isc.org>
Tue, 23 Apr 2024 07:27:35 +0000 (09:27 +0200)
- fixing a bug where when postgresql used as hosts reservations backend and
  when trying to delete only one reservation with host_cmds reservation-del
  by ipv6 and subnet-id, all host reservations in given subnet were deleted

src/lib/dhcpsrv/pgsql_host_data_source.cc

index 8db86ffa491415d038ed94d5c18a4f1fd8915154..5732f74d9978dc894a909a56124be156084f5c0a 100644 (file)
@@ -2191,7 +2191,8 @@ TaggedStatementArray tagged_statements = { {
      { OID_INT8, OID_VARCHAR },
      "del_host_addr6",
      "DELETE FROM hosts USING ipv6_reservations "
-     "  WHERE dhcp6_subnet_id = $1 AND ipv6_reservations.address = cast($2 as inet)"
+     "  WHERE hosts.host_id = ipv6_reservations.host_id"
+     "  AND dhcp6_subnet_id = $1 AND ipv6_reservations.address = cast($2 as inet)"
     },
 
     // PgSqlHostDataSourceImpl::DEL_HOST_SUBID4_ID