On 07/21/2016 06:49 AM, Tom Lane wrote:
David Fetter <da...@fetter.org> writes:
Please find attached a patch which makes it possible to disallow
UPDATEs and DELETEs which lack a WHERE clause. As this changes query
behavior, I've made the new GUCs PGC_SUSET.
What say?
-1
-1. This is an express violation of the SQL standard, and at least the
UPDATE case has reasonable use-cases. Moreover, if your desire is to have
training wheels for SQL, there are any number of other well-known gotchas
that are just as dangerous, for example ye olde unintentionally-correlated
subselect:
https://www.postgresql.org/message-id/20160714135233.1410.92538%40wrigleys.postgresql.org
Yes but I used to teach a weak long class on relational databases using
PostgreSQL. The entire week I would iterate over and over and over that
you never use an UPDATE or DELETE without a transaction. Toward the end
of the class we would being do problem sets that included UPDATE and
DELETE. Guess how many would trash their data because they didn't use a
WHERE clause AND didn't use a transaction? 50%
These weren't kids, these weren't neophytes to technology. These were
professionals, many of them programmers (PICK).
I wouldn't have any objection to an extension that enforces rules like
these, but I don't think it belongs in core.
I agree it doesn't need to be in core.
JD
regards, tom lane
--
Command Prompt, Inc. http://the.postgres.company/
+1-503-667-4564
PostgreSQL Centered full stack support, consulting and development.
Everyone appreciates your honesty, until you are honest with them.
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers