Strange DOMAIN behavior
От | Alex Ignatov |
---|---|
Тема | Strange DOMAIN behavior |
Дата | |
Msg-id | 559E470F.6020002@postgrespro.ru обсуждение исходный текст |
Ответы |
Strange DOMAIN behavior
|
Список | pgsql-sql |
Hello everyone!!! Got strange DOMAIN behavior in the following plpgsql code: postgres=# DROP DOMAIN lexema_str CASCADE; DROP DOMAIN postgres=# CREATE DOMAIN lexema_str TEXT DEFAULT 'abc'; CREATE DOMAIN postgres=# DO $$ postgres$# DECLARE postgres$# lex lexema_str; postgres$# BEGIN postgres$# RAISE NOTICE 'lex = %', lex; postgres$# END; postgres$# $$; NOTICE: lex = <NULL> DO But i expect that lex = abc! So default value of DOMAIN type is not set in pgplsql block but: postgres=# DROP DOMAIN lexema_str CASCADE; DROP DOMAIN postgres=# CREATE DOMAIN lexema_str TEXT DEFAULT 'abc' NOT NULL; CREATE DOMAIN postgres=# DO $$ postgres$# DECLARE postgres$# lex lexema_str; postgres$# BEGIN postgres$# RAISE NOTICE 'lex = %', lex; postgres$# END; postgres$# $$; ERROR: domain lexema_str does not allow null values CONTEXT: PL/pgSQL function inline_code_block line 4 during statement block local variable initialization So constraints in DOMAIN type work in pgplsql ! Is this correct behavior?? -- Alex Ignatov Postgres Professional: http://www.postgrespro.com The Russian Postgres Company --- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus
В списке pgsql-sql по дате отправления: