From 46d9b58b321e5a3694f189531739a0ed28eb8cdf Mon Sep 17 00:00:00 2001 From: Allan Bowe Date: Wed, 13 Jul 2022 18:01:52 +0000 Subject: [PATCH] fix: avoid exceptions from dictionary.table_constraints. Closes #283 --- all.sas | 5 ++++- base/mp_getconstraints.sas | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/all.sas b/all.sas index 05f71b0..f8df375 100644 --- a/all.sas +++ b/all.sas @@ -6665,8 +6665,11 @@ create table &outds as /** * We cannot apply this clause to the underlying dictionary table. See: * https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771554#M244867 + * cannot use`where calculated libref="&lib"` either as it will STILL execute + * all the underlying constraint queries, causing exception errors in some + * cases: https://github.com/sasjs/core/issues/283 */ - where calculated libref="&lib" + where a.TABLE_CATALOG="&lib" %if "&ds" ne "" %then %do; and upcase(a.TABLE_NAME)="&ds" and upcase(b.TABLE_NAME)="&ds" diff --git a/base/mp_getconstraints.sas b/base/mp_getconstraints.sas index 95eac49..1ba65a9 100644 --- a/base/mp_getconstraints.sas +++ b/base/mp_getconstraints.sas @@ -94,8 +94,11 @@ create table &outds as /** * We cannot apply this clause to the underlying dictionary table. See: * https://communities.sas.com/t5/SAS-Programming/Unexpected-Where-Clause-behaviour-in-dictionary-TABLE/m-p/771554#M244867 + * cannot use`where calculated libref="&lib"` either as it will STILL execute + * all the underlying constraint queries, causing exception errors in some + * cases: https://github.com/sasjs/core/issues/283 */ - where calculated libref="&lib" + where a.TABLE_CATALOG="&lib" %if "&ds" ne "" %then %do; and upcase(a.TABLE_NAME)="&ds" and upcase(b.TABLE_NAME)="&ds"