According to the documentation (
https://www.postgresql.org/docs/13/sql-dropfunction.html), DROP FUNCTION RESTRICT should refuse to drop a function if any objects depend on it. This behavior doesn't appear to be upheld for GENERATED columns, which appear not to track the dependency.
Version: PostgreSQL 13.1
SETUP:
jordan=# CREATE FUNCTION f (a INT) RETURNS INT AS 'SELECT a' IMMUTABLE LANGUAGE SQL;
CREATE FUNCTION
jordan=# CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (f(a)) STORED);
CREATE TABLE
jordan=# INSERT INTO t VALUES(1);
INSERT 0 1
jordan=# SELECT * FROM t;
a | b
---+---
1 | 1
(1 row)
jordan=# DROP FUNCTION f RESTRICT;
EXPECTED BEHAVIOR:
An error is returned, preventing the DROP FUNCTION from succeeding because t.b depends on f.
ACTUAL BEHAVIOR:
No error is returned, and t.b is silently dropped.