Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL Exam PGCES-02 Topic 11 Question 38 Discussion

Actual exam question for PostgreSQL's PGCES-02 exam
Question #: 38
Topic #: 11
[All PGCES-02 Questions]

A table is defined as follows: CREATE TABLE t (id INT, val TEXT); Select two correct statements from below about the function "get_head" defined below. CREATE

FUNCTION get_head(BOOLEAN) RETURNS TEXT LANGUAGE sql CALLED ON

NULL INPUT AS 'SELECT val FROM t WHERE $1 OR id > 0 ORDER BY id LIMIT 1;';

Show Suggested Answer Hide Answer
Suggested Answer: A, D

Contribute your Thoughts:

Howard
17 hours ago
This question is making my head spin! I bet the exam writer is having a good laugh at our expense. Anyway, I'm sticking with C and D, they seem the most reasonable to me.
upvoted 0 times
...
Noah
8 days ago
I believe statement E is true because having a function with the same name and parameter type can cause an error.
upvoted 0 times
...
Truman
10 days ago
Wait, is this a trick question? What if the table is empty? In that case, the function would return NULL, so C is definitely correct. As for the other statement, I'll go with D - it sounds like it could return different values even with the same parameter.
upvoted 0 times
...
Lucille
10 days ago
I agree with statement D because the function might not always return the same value.
upvoted 0 times
...
Ashleigh
13 days ago
I'm a bit stumped on this one. Is the function going to return the first row based on the id, or the first row where the condition is true? I guess I'll go with C and D, just to be safe.
upvoted 0 times
...
Mollie
13 days ago
I think statement C is correct because if NULL is passed, NULL is returned.
upvoted 0 times
...
Glendora
16 days ago
This is a tricky one! I'm going to say B and D are the correct statements. The function could return multiple lines if there are multiple rows with id > 0, and the returned value might change if the table is updated between function calls.
upvoted 0 times
Teri
3 days ago
I think B is correct because the function could return multiple lines.
upvoted 0 times
...
...
Vanesa
17 days ago
Hmm, if the function is called with NULL input, it should return NULL, so C is correct. But I'm not sure about the other statement, let me think about it.
upvoted 0 times
...
Nohemi
18 days ago
The function is not defined using PL/pgSQL, it's using SQL language. I'm going with C and D.
upvoted 0 times
...

Save Cancel
az-700  pass4success  az-104  200-301  200-201  cissp  350-401  350-201  350-501  350-601  350-801  350-901  az-720  az-305  pl-300  

Warning: Cannot modify header information - headers already sent by (output started at /pass.php:70) in /pass.php on line 77