From 2a9a29743f5405b29001bb9122666e176d8956bf Mon Sep 17 00:00:00 2001 From: Maximilian Rehkopf Date: Fri, 17 May 2019 13:56:30 +0200 Subject: [PATCH] Sakila/PostgreSQL: Replace nonexisting IF with CASE --- .../Sakila/postgres-sakila-db/postgres-sakila-schema.sql | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-schema.sql b/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-schema.sql index f452c498c0..bf40db1a9f 100644 --- a/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-schema.sql +++ b/jOOQ-examples/Sakila/postgres-sakila-db/postgres-sakila-schema.sql @@ -684,8 +684,9 @@ BEGIN AND rental.rental_date <= p_effective_date AND rental.customer_id = p_customer_id; - SELECT COALESCE(SUM(IF((rental.return_date - rental.rental_date) > (film.rental_duration * '1 day'::interval), - ((rental.return_date - rental.rental_date) - (film.rental_duration * '1 day'::interval)),0)),0) INTO v_overfees + SELECT COALESCE(SUM(CASE WHEN (rental.return_date - rental.rental_date) > (film.rental_duration * '1 day'::interval) + THEN EXTRACT(DAY FROM (rental.return_date - rental.rental_date) - (film.rental_duration * '1 day'::interval))::integer + ELSE 0 END),0) INTO v_overfees FROM rental, inventory, film WHERE film.film_id = inventory.film_id AND inventory.inventory_id = rental.inventory_id