Bird
0
0

What will be the output of this DO block?

medium📝 query result Q13 of 15
PostgreSQL - PL/pgSQL Fundamentals
What will be the output of this DO block?
DO $$
BEGIN
  RAISE NOTICE 'Hello, PostgreSQL!';
END
$$ LANGUAGE plpgsql;
AIt prints 'Hello, PostgreSQL!' as a notice message
BIt returns a result set with 'Hello, PostgreSQL!'
CIt causes a syntax error
DIt creates a permanent function named 'Hello, PostgreSQL!'
Step-by-Step Solution
Solution:
  1. Step 1: Understand RAISE NOTICE in DO blocks

    RAISE NOTICE outputs a message to the client as an informational notice, not a query result.
  2. Step 2: Analyze the DO block behavior

    The block runs immediately and prints the notice message but does not return rows or create functions.
  3. Final Answer:

    It prints 'Hello, PostgreSQL!' as a notice message -> Option A
  4. Quick Check:

    RAISE NOTICE outputs messages, not query results [OK]
Quick Trick: RAISE NOTICE shows messages, no query output [OK]
Common Mistakes:
  • Expecting query result rows
  • Thinking it creates a function
  • Confusing notice with error

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More PostgreSQL Quizzes