New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

PostgreSQL PGCES-02 Exam - 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:

0/2000 characters
Keneth
4 months ago
I've heard about errors with duplicate function names, so E might be true.
upvoted 0 times
...
Rikki
4 months ago
Wait, are you sure it won't return NULL if NULL is passed?
upvoted 0 times
...
Louvenia
5 months ago
I think it could return different values on multiple calls.
upvoted 0 times
...
Tasia
5 months ago
Totally agree, it returns only one line due to LIMIT 1.
upvoted 0 times
...
Novella
5 months ago
This function is written in SQL, not PL/pgSQL.
upvoted 0 times
...
Freida
5 months ago
I vaguely recall something about functions returning different values even with the same input, so option D could be possible, but I'm not completely confident.
upvoted 0 times
...
Martha
5 months ago
I practiced a similar question, and I think if NULL is passed, it should return NULL based on how the function is structured, so option C seems correct.
upvoted 0 times
...
Stefan
5 months ago
I'm not sure, but I feel like the function could return multiple lines if the condition is met, which makes me think option B might be true.
upvoted 0 times
...
Ronna
5 months ago
I remember that functions defined with SQL language don't use PL/pgSQL, so I think option A is definitely incorrect.
upvoted 0 times
...
Laurene
5 months ago
This seems like a good opportunity to demonstrate my understanding of APIs and how they can be used to integrate different systems. I'll make sure to explain the benefits clearly and provide a specific example of how the company could implement this.
upvoted 0 times
...
Salena
5 months ago
I remember we discussed the importance of requiring suppliers to implement a sales and operations planning process. That might help, but I feel like it's more about managing capacity than directly preventing interruptions.
upvoted 0 times
...
Howard
11 months 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
Clarence
9 months ago
User1
upvoted 0 times
...
Harris
9 months ago
User3
upvoted 0 times
...
Sharita
9 months ago
User2
upvoted 0 times
...
Dulce
9 months ago
User1
upvoted 0 times
...
Tamra
9 months ago
I agree with you, C and D seem like the most reasonable choices.
upvoted 0 times
...
Lottie
9 months ago
I believe A is incorrect, but C and D make sense to me.
upvoted 0 times
...
Clorinda
9 months ago
I'm not sure about B, but I agree with C and D.
upvoted 0 times
...
Mickie
9 months ago
Yeah, D makes sense too. Let's go with C and D for our answers.
upvoted 0 times
...
Mickie
10 months ago
I agree with you on C. I also think D is correct because the returned values may not be the same.
upvoted 0 times
...
Blythe
10 months ago
I think C and D are correct too.
upvoted 0 times
...
Mickie
10 months ago
I think C is correct because when NULL is passed, NULL is returned.
upvoted 0 times
...
...
Noah
11 months 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
11 months 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
Adolph
10 months ago
User 2
upvoted 0 times
...
Anika
10 months ago
User 1
upvoted 0 times
...
...
Lucille
11 months ago
I agree with statement D because the function might not always return the same value.
upvoted 0 times
...
Ashleigh
11 months 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
11 months ago
I think statement C is correct because if NULL is passed, NULL is returned.
upvoted 0 times
...
Glendora
11 months 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
10 months ago
I agree, and D is also correct because the returned value might change between function calls.
upvoted 0 times
...
Teri
11 months ago
I think B is correct because the function could return multiple lines.
upvoted 0 times
...
...
Vanesa
11 months 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
11 months 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