Can we name not null constraints?

Moderator: NorbertKrupa

Post Reply
Brett
Beginner
Beginner
Posts: 49
Joined: Fri Oct 11, 2013 1:19 am

Can we name not null constraints?

Post by Brett » Fri Dec 27, 2013 8:10 pm

In Oracle I can name my table column not null constraints. I can't figure out how to do this in Vertica. Does anyone know how?

I tried...

Code: Select all

dbadmin=> create table my_test (t int);
CREATE TABLE
dbadmin=> alter table my_test add constraint col1_nn not null (t);
ERROR 4856:  Syntax error at or near "not" at character 44
LINE 1: alter table my_test add constraint col1_nn not null (t);
                                                   ^
dbadmin=> alter table my_test add constraint col1_pk primary key (t);
WARNING 2623:  Column "t" definition changed to NOT NULL
ALTER TABLE

Code: Select all

dbadmin=> select table_name, column_name, constraint_name, constraint_type
dbadmin-> from constraint_columns where table_name = 'my_test';
 table_name | column_name | constraint_name | constraint_type
------------+-------------+-----------------+-----------------
 my_test    | t           | C_NOTNULL       | n
 my_test    | t           | col1_pk         | p
(2 rows)
Vertica gave the not null constraint the name C_NOTNULL :evil:

id10t
GURU
GURU
Posts: 732
Joined: Mon Apr 16, 2012 2:44 pm

Re: Can we name not null constraints?

Post by id10t » Sun Dec 29, 2013 6:08 pm

Hi!

[DELETED]
Last edited by id10t on Fri May 08, 2015 9:19 pm, edited 1 time in total.

Brett
Beginner
Beginner
Posts: 49
Joined: Fri Oct 11, 2013 1:19 am

Re: Can we name not null constraints?

Post by Brett » Mon Dec 30, 2013 12:11 pm

I didn't ask HOW to add a not null constraint, I asked how to NAME a not null constraint. :roll: Your nasty comments aren't particularly helpful.

Post Reply

Return to “New to Vertica Database Administration”