An explicit pass-through request with the CASCADE= option will truncate a table. However, if you do so for a PostgreSQL database, you might see a warning message in your SAS® log, which results in SAS setting a nonzero return code. An example of the SAS log output is shown here:
23 PROC SQL ;
24 CONNECT TO POSTGRES ( DATABASE=database PORT=port-number SERVER="server-name" USER=user-id PASSWORD=password );
25 EXECUTE ( TRUNCATE TABLE schema.table-name CASCADE ) BY POSTGRES;
WARNING: During execute: NOTICE: truncate cascades to table "table-name"
26 DISCONNECT FROM POSTGRES;
27 QUIT;
SAS interprets the informational message from PostgreSQL as a warning. SAS then writes the warning message to the log and sets the SAS automatic macro variable SYSCC to 4.
Workaround
You must instruct PostgreSQL to generate messages for message values that are for WARNING or above.
The PostgreSQL documentation states the following:
“client_min_messages (string)
Controls which message levels are sent to the client. Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2,
DEBUG1, LOG, NOTICE, WARNING, ERROR, FATAL, and PANIC. Each level includes all the levels that follow it.
The later the level, the fewer messages are sent. The default is NOTICE.”
Use the following EXECUTE statement:
execute( set client_min_messages='warning' ) by postgres;
This workaround can be used for other informational messages, such as the following:
WARNING: During execute: NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "index-name" for table "table-name"
After you apply the workaround, informational or NOTICE messages are no longer passed back from PostgreSQL to SAS, and related warning messages are not triggered in your SAS program.
Operating System and Release Information
| SAS System | SAS/ACCESS Interface to PostgreSQL | Microsoft® Windows® for x64 | | |
| Microsoft Windows 8 Enterprise 32-bit | | |
| Microsoft Windows 8 Enterprise x64 | | |
| Microsoft Windows 8 Pro 32-bit | | |
| Microsoft Windows 8 Pro x64 | | |
| Microsoft Windows 8.1 Enterprise 32-bit | | |
| Microsoft Windows 8.1 Enterprise x64 | | |
| Microsoft Windows 8.1 Pro 32-bit | | |
| Microsoft Windows 8.1 Pro x64 | | |
| Microsoft Windows 10 | | |
| Microsoft Windows 95/98 | | |
| Microsoft Windows 2000 Advanced Server | | |
| Microsoft Windows 2000 Datacenter Server | | |
| Microsoft Windows 2000 Server | | |
| Microsoft Windows 2000 Professional | | |
| Microsoft Windows NT Workstation | | |
| Microsoft Windows Server 2003 Datacenter Edition | | |
| Microsoft Windows Server 2003 Enterprise Edition | | |
| Microsoft Windows Server 2003 Standard Edition | | |
| Microsoft Windows Server 2003 for x64 | | |
| Microsoft Windows Server 2008 | | |
| Microsoft Windows Server 2008 R2 | | |
| Microsoft Windows Server 2008 for x64 | | |
| Microsoft Windows Server 2012 Datacenter | | |
| Microsoft Windows Server 2012 R2 Datacenter | | |
| Microsoft Windows Server 2012 R2 Std | | |
| Microsoft Windows Server 2012 Std | | |
| Microsoft Windows Server 2016 | | |
| Microsoft Windows XP Professional | | |
| Windows 7 Enterprise 32 bit | | |
| Windows 7 Enterprise x64 | | |
| Windows 7 Home Premium 32 bit | | |
| Windows 7 Home Premium x64 | | |
| Windows 7 Professional 32 bit | | |
| Windows 7 Professional x64 | | |
| Windows 7 Ultimate 32 bit | | |
| Windows 7 Ultimate x64 | | |
| Windows Millennium Edition (Me) | | |
| Windows Vista | | |
| Windows Vista for x64 | | |
| 64-bit Enabled AIX | | |
| 64-bit Enabled Solaris | | |
| HP-UX IPF | | |
| Linux for x64 | | |
| Solaris for x64 | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.