Showing posts with label error. Show all posts
Showing posts with label error. Show all posts

Wednesday, September 4, 2024

Snowflake SQL error: NULL result in a non-nullable column

Troubleshooting Snowflake SQL Error : NULL result in a non-nullable column

When working with Snowflake, you might encounter the error message:

SQL Error [100072] [22000]: NULL result in a non-nullable column

This error can be misleading at first glance. Let's walk through a common scenario that triggers this error and how to resolve it.

Scenario

Consider the following SQL script:

-- Create the test table
CREATE TABLE set_test (
    id INT NOT NULL,
    is_deleted CHAR(1) NOT NULL,
    foo FLOAT NULL
);

-- Insert a few records
INSERT INTO set_test (id, is_deleted, foo) VALUES
(1, 'F', 10.5),
(2, 'F', 20.0),
(3, 'F', 30.75);

-- Update one record to set is_deleted to 'T' and foo to NULL
UPDATE set_test
SET is_deleted = 'T' and foo = NULL
WHERE id = 2;

When you run the UPDATE statement, Snowflake returns the error message:

SQL Error [100072] [22000]: NULL result in a non-nullable column

Understanding the Error

The error message indicates that there is an attempt to insert a NULL value into a column that does not allow NULL values. However, in this case, the error is not due to the NULL value itself but rather a syntax issue in the UPDATE statement.

Resolving the Error

The issue lies in the UPDATE statement:

UPDATE set_test
SET is_deleted = 'T' and foo = NULL
WHERE id = 2;

In SQL, the SET clause should use commas to separate multiple column assignments, not the AND keyword. The correct UPDATE statement should be:

UPDATE set_test
SET is_deleted = 'T', foo = NULL
WHERE id = 2;

By replacing and with a comma, the UPDATE statement will execute without errors:

UPDATE set_test
SET is_deleted = 'T', foo = NULL
WHERE id = 2;

Conclusion

When you encounter the "NULL result in a non-nullable column" error in Snowflake, double-check the syntax of your UPDATE statement. Ensure that you are using commas to separate column assignments in the SET clause. This simple fix can save you time and prevent confusion when troubleshooting SQL errors.

If this does not help, see also Snowflake KB Inserting or loading data in table fails with error "NULL result in a non-nullable column".

Saturday, May 20, 2023

openwrt ssh connection refused

Symptom

Normal connection attempt
$ ssh root@192.168.1.1
Connection to 192.168.1.1 closed.
End of log with verbose ssh
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering public key: /home/z/.ssh/id_ed25519 ED25519 SHA256:XX//XX/XX agent
debug1: Server accepts key: /home/z/.ssh/id_ed25519 ED25519 SHA256:XX//XX/XX agent
Authenticated to 192.168.1.1 ([192.168.1.1]:22) using "publickey".
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: Sending environment.
debug1: channel 0: setting env LANG = "en_US.UTF-8"
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Connection to 192.168.1.1 closed.
Transferred: sent 2488, received 1012 bytes, in 0.0 seconds
Bytes per second: sent 346691.3, received 141017.5
debug1: Exit status 1
System log snippet in OpenWRT's luci interface
Sat May 20 23:02:33 2023 authpriv.notice dropbear[7690]: Pubkey auth succeeded for 'root' with ssh-ed25519 key SHA256:XX//XX/XX from 192.168.1.X:X
Sat May 20 23:02:33 2023 authpriv.info dropbear[7691]: Exit (root) from <192.168.1.X:X>: Child failed
Sat May 20 23:02:33 2023 authpriv.info dropbear[7690]: Exit (root) from <192.168.1.X:X>: Disconnect received

Background

A few weeks ago, I installed OpenWRT 22.03.3 on my Belkin RT3200. SSH and everything else was working fine until I updated it to OpenWRT 22.03.5, and then immedietly SSH refused to connect.

Solution

I read a GitHub conversation about a similar problem. In their case, zsh was missing, and I remembered that earlier I installed Bash. I reinstalled it via LuCI, and then SSH worked again.

Tuesday, August 30, 2016

SAS ERROR: Cannot load SSL support. on Microsoft Windows

When using SAS with HTTPS or FTPS, which requires SSL/TLS support, you may see this error message in the SAS log.

ERROR: Cannot load SSL support.

Here is an example of code that can trigger the error.

filename myref url "https://www.google.com";
data _null_; 
infile myref; 
run;

The cause was that

Benchmarking the TP-Link TL-WPA7510 Powerline kit

Real-World Powerline Networking Benchmarks A practical look at HomePlug AV2 performance across outlets, with iperf3 & ping TL;DR: Po...