# Test multiple notices all display at once.
query T noticetrace
SELECT crdb_internal.notice('hi'), crdb_internal.notice('i am....'), crdb_internal.notice('otan!!!')
----
NOTICE: hi
NOTICE: i am....
NOTICE: otan!!!

subtest test_notice_severity

query T noticetrace
SELECT crdb_internal.notice('debug1', 'do not see this'), crdb_internal.notice('warning', 'but you see this'), crdb_internal.notice('debug2', 'and never this')
----
WARNING: but you see this

statement ok
SET client_min_messages = 'debug1'

query T noticetrace
SELECT crdb_internal.notice('debug1', 'now you see this'), crdb_internal.notice('warning', 'and you see this'), crdb_internal.notice('debug2', 'and never this')
----
DEBUG1: now you see this
WARNING: and you see this

statement ok
CREATE DATABASE d;
CREATE TABLE d.t (x int)

# Weak isolation levels emit extra notices, so skip them.
skipif config weak-iso-level-configs
query T noticetrace
ALTER TABLE d.t RENAME TO d.t2
----
NOTICE: renaming tables with a qualification is deprecated
HINT: use ALTER TABLE d.t RENAME TO t2 instead

# Start off with an empty enum, and add values to it.
statement ok
CREATE TYPE color AS ENUM ()

statement ok
ALTER TYPE color ADD VALUE 'black'

# Weak isolation levels emit extra notices, so skip them.
skipif config weak-iso-level-configs
query T noticetrace
ALTER TYPE color ADD VALUE IF NOT EXISTS 'black'
----
NOTICE: enum value "black" already exists, skipping

statement ok
CREATE MATERIALIZED VIEW v AS SELECT 1

# Weak isolation levels emit extra notices, so skip them.
skipif config weak-iso-level-configs
query T noticetrace
REFRESH MATERIALIZED VIEW CONCURRENTLY v
----
NOTICE: CONCURRENTLY is not required as views are refreshed concurrently

query T noticetrace
UNLISTEN temp
----
NOTICE: unimplemented: CRDB does not support LISTEN, making UNLISTEN a no-op
HINT: You have attempted to use a feature that is not yet implemented.
See: https://go.crdb.dev/issue-v/41522/v25.1
SQLSTATE: 0A000
