← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 2004581] Re: Neutron API query error, implicit cast does not exist in postgresql

 

Reviewed:  https://review.opendev.org/c/openstack/neutron/+/872745
Committed: https://opendev.org/openstack/neutron/commit/61b2917a3e8596cbb4074024cee0844e319ed551
Submitter: "Zuul (22348)"
Branch:    master

commit 61b2917a3e8596cbb4074024cee0844e319ed551
Author: Rodolfo Alonso Hernandez <ralonsoh@xxxxxxxxxx>
Date:   Fri Feb 3 21:06:00 2023 +0100

    Filter subnets by "enable_dhcp" flag using the correct type
    
    While other SQL engines can compare interger and boolean types,
    PostgreSQL needs explicit casting to compare variables. Method
    "_sync_subnet_dhcp_options" is currently raising the following
    error:
      operator does not exist: boolean = integer
    
    Closes-Bug: #2004581
    Change-Id: I715029c311c4516f3212054c5c72533b12fd0986


** Changed in: neutron
       Status: In Progress => Fix Released

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/2004581

Title:
  Neutron API query error, implicit cast does not exist in postgresql

Status in neutron:
  Fix Released

Bug description:
  Version:  openstack-neutron-21.0.0-1.el9s
  Database version:  postgresql 10.22
  Distro: Centos streams 9.1
  Manual deployment

  While debugging OVN compute network connectivity, I found an error on
  neutron_server_api that may be related.  Neutron server is reporting
  query errors for dhcp information:

  oslo_db.exception.DBError: (psycopg2.errors.UndefinedFunction) operator does not exist: boolean = integer
  LINE 3: WHERE subnets.enable_dhcp IN (1)
  HINT:  No operator matches the given name and argument type(s). You might need to add explicit type casts.
  ...

  [SQL: SELECT subnets.project_id AS subnets_project_id, subnets.id AS
  subnets_id, subnets.in_use AS subnets_in_use, subnets.name AS
  subnets_name, subnets.network_id AS subnets_network_id,
  subnets.segment_id AS subnets_segment_id, subnets.subnetpool_id AS
  subnets_subnetpool_id, subnets.ip_version AS subnets_ip_version,
  subnets.cidr AS subnets_cidr, subnets.gateway_ip AS
  subnets_gateway_ip, subnets.enable_dhcp AS subnets_enable_dhcp,
  subnets.ipv6_ra_mode AS subnets_ipv6_ra_mode,
  subnets.ipv6_address_mode AS subnets_ipv6_address_mode,
  subnets.standard_attr_id AS subnets_standard_attr_id,
  subnetpools_1.shared AS subnetpools_1_shared, standardattributes_1.id
  AS standardattributes_1_id, standardattributes_1.resource_type AS
  standardattributes_1_resource_type, standardattributes_1.description
  AS standardattributes_1_description,
  standardattributes_1.revision_number AS
  standardattributes_1_revision_number, standardattributes_1.created_at
  AS standardattributes_1_created_at, standardattributes_1.updated_at AS
  standardattributes_1_updated_at, subnetpools_1.project_id AS
  subnetpools_1_project_id, subnetpools_1.id AS subnetpools_1_id,
  subnetpools_1.name AS subnetpools_1_name, subnetpools_1.ip_version AS
  subnetpools_1_ip_version, subnetpools_1.default_prefixlen AS
  subnetpools_1_default_prefixlen, subnetpools_1.min_prefixlen AS
  subnetpools_1_min_prefixlen, subnetpools_1.max_prefixlen AS
  subnetpools_1_max_prefixlen, subnetpools_1.is_default AS
  subnetpools_1_is_default, subnetpools_1.default_quota AS
  subnetpools_1_default_quota, subnetpools_1.hash AS subnetpools_1_hash,
  subnetpools_1.address_scope_id AS subnetpools_1_address_scope_id,
  subnetpools_1.standard_attr_id AS subnetpools_1_standard_attr_id,
  standardattributes_2.id AS standardattributes_2_id,
  standardattributes_2.resource_type AS
  standardattributes_2_resource_type, standardattributes_2.description
  AS standardattributes_2_description,
  standardattributes_2.revision_number AS
  standardattributes_2_revision_number, standardattributes_2.created_at
  AS standardattributes_2_created_at, standardattributes_2.updated_at AS
  standardattributes_2_updated_at,
  subnet_dns_publish_fixed_ips_1.subnet_id AS
  subnet_dns_publish_fixed_ips_1_subnet_id,
  subnet_dns_publish_fixed_ips_1.dns_publish_fixed_ip AS
  subnet_dns_publish_fixed_ips_1_dns_publish_fixed_ip

  FROM subnets LEFT OUTER JOIN subnetpools AS subnetpools_1 ON
  subnets.subnetpool_id = subnetpools_1.id LEFT OUTER JOIN
  standardattributes AS standardattributes_1 ON standardattributes_1.id
  = subnetpools_1.standard_attr_id LEFT OUTER JOIN standardattributes AS
  standardattributes_2 ON standardattributes_2.id =
  subnets.standard_attr_id LEFT OUTER JOIN subnet_dns_publish_fixed_ips
  AS subnet_dns_publish_fixed_ips_1 ON subnets.id =
  subnet_dns_publish_fixed_ips_1.subnet_id

  WHERE subnets.enable_dhcp IN (%(enable_dhcp_1_1)s)]

   [parameters: {'enable_dhcp_1_1': 1}]


  Checking the neutron db directly, the above query requires an explicit
  cast:

  ie:     WHERE subnets.enable_dhcp IN (1::BOOLEAN);

  Adding the cast to the query, returns the expected rows.

  I'm not sure where this is set in the code.

  Thanks
  Gary

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/2004581/+subscriptions



References