Skip to main content

Is DISABLE_DUPLICATE_KEY_ERROR() deprecated in Vertica 8.1?

  • August 25, 2017
  • 1 reply
  • 9 views

chaima
Forum|alt.badge.img+2
  • Participating Frequently

With pre-join projections being deprecated, are DISABLE_DUPLICATE_KEY_ERROR() and REENABLE_DUPLICATE_KEY_ERROR() fucntions deprecated? Otherwise, how can one use them?

Thanks

1 reply

Jim_Knicely
Forum|alt.badge.img+2
  • Participating Frequently
  • September 7, 2017

Hi,

They have not been deprecated.

The DISABLE_DUPLICATE_KEY_ERROR() and REENABLE_DUPLICATE_KEY_ERROR() functions are only relevant when key constraints not automatically enabled (See: EnableNewPrimaryKeysByDefault param).

Simple example:

dbadmin=> select get_config_parameter('EnableNewPrimaryKeysByDefault');
 get_config_parameter
----------------------
 0
(1 row)

dbadmin=> create table a (c int not null primary key);
CREATE TABLE
dbadmin=> insert into a select 1;
 OUTPUT
--------
      1
(1 row)

dbadmin=> insert into a select 1;
 OUTPUT
--------
      1
(1 row)

dbadmin=> commit;
COMMIT

dbadmin=> select * from a join a a2 using (c);
ERROR 3149:  Duplicate primary/unique key detected in join [(public.a x public.a) using a_super and a_super (PATH ID: 1)]; value [1]

dbadmin=> select DISABLE_DUPLICATE_KEY_ERROR();
WARNING 3152:  Duplicate values in columns marked as UNIQUE will now be ignored for the remainder of your session or until reenable_duplicate_key_error() is called
WARNING 3539:  Incorrect results are possible. Please contact Vertica Support if unsure
 DISABLE_DUPLICATE_KEY_ERROR
------------------------------
 Duplicate key error disabled
(1 row)

dbadmin=> select * from a join a a2 using (c);
 c
---
 1
 1
 1
 1
(4 rows)