You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Chapter 17: Saving Time with Views, Functions, and Triggers - Listing 17-15
Operating System: Windows 10
Did you install PostgreSQL, PostGIS and pgAdmin according to the steps in Chapter 1?
Yes
Which versions of PostgreSQL and pgAdmin 4 are you using?
PostgreSQL 16
pgAdmin 4 - Version 8.10
Did you download the book's code examples and data from GitHub using the directions in Chapter 1?
Yes
Chapter, page and code listing number:
Chapter 17: Saving Time with Views, Functions, and Triggers, pages 351-352, Listing 17-15
Describe the issue or your question:
Unable to resolve error (see below). I did some internet searching, but couldn't find any suggestions to resolve this on my own.
Please paste the code and error message here. It's OK to alter identifying info such as a folder name
ERROR: unterminated dollar-quoted string at or near "$$
BEGIN
UPDATE teachers
SET personal_days =
CASE WHEN (now() - hire_date) >= '10 years'::interval
AND (now() - hire_date) < '15 years'::interval THEN 4
WHEN (now() - hire_date) >= '15 years'::interval
AND (now() - hire_date) < '20 years'::interval THEN 5
WHEN (now() - hire_date) >= '20 years'::interval
AND (now() - hire_date) < '25 years'::interval THEN 6
WHEN (now() - hire_date) >= '25 years'::interval THEN 7
ELSE 3
END;"
LINE 2: AS $$
^
SQL state: 42601
Character: 55
The text was updated successfully, but these errors were encountered:
In pgAdmin, please make sure you have highlighted the entire block of code for Listing 17-15 before running it. A recent change to pgAdmin lets a user just click anywhere into a block of code to run it. That works OK for most queries/statements, but in more complicated ones like this it doesn't work so well.
I just ran Listing 17-15 on a fresh database on Windows and it worked fine, so I suspect that is the issue you're having.
Chapter 17: Saving Time with Views, Functions, and Triggers - Listing 17-15
Operating System: Windows 10
Did you install PostgreSQL, PostGIS and pgAdmin according to the steps in Chapter 1?
Which versions of PostgreSQL and pgAdmin 4 are you using?
Did you download the book's code examples and data from GitHub using the directions in Chapter 1?
Chapter, page and code listing number:
Chapter 17: Saving Time with Views, Functions, and Triggers, pages 351-352, Listing 17-15
Describe the issue or your question:
Unable to resolve error (see below). I did some internet searching, but couldn't find any suggestions to resolve this on my own.
Please paste the code and error message here. It's OK to alter identifying info such as a folder name
ERROR: unterminated dollar-quoted string at or near "$$
BEGIN
UPDATE teachers
SET personal_days =
CASE WHEN (now() - hire_date) >= '10 years'::interval
AND (now() - hire_date) < '15 years'::interval THEN 4
WHEN (now() - hire_date) >= '15 years'::interval
AND (now() - hire_date) < '20 years'::interval THEN 5
WHEN (now() - hire_date) >= '20 years'::interval
AND (now() - hire_date) < '25 years'::interval THEN 6
WHEN (now() - hire_date) >= '25 years'::interval THEN 7
ELSE 3
END;"
LINE 2: AS $$
^
SQL state: 42601
Character: 55
The text was updated successfully, but these errors were encountered: