by bun_at_work · 3y ago · 0 comments
How can I get help with this now?
Google result 1: https://stackoverflow.com/questions/77148711/create-a-trigge...
Google result 2: https://dba.stackexchange.com/questions/307448/postgresql-tr...
Like 90% of my questions like this are going to ChatGPT these days.
I can figure it out via the docs, but ChatGPT is SO convenient for things like this.
Failing that, read the documentation. Failing that, stand up a quick experiment.
Somehow, we survived before ChatGPT and even before saturated question boards. Those strategies are still available to you and well worth learning
And this is what happens when, say, you loose a job you've been doing for 10-15 years. You need to re-learn the world. And a lifetime is not enough to do it the way we used to do it.
But with it being down, my biggest advice would be to try it and see. something like dbfiddle.uk is perfect for these kinds of tests.
Also, when I asked it "what if I use PostgreSQL's non-transactional triggers", which I thought I just made up, it told me it wouldn't roll back the first insert: Non-transactional triggers are executed as part of the statement that triggered them, but they don't participate in the transaction control. So now I don't know what to think.
Try it and see? Why do you need an AI to help with this?
Copying information from ChatGPT is the newer version of blindly copying answers from StackOverflow. It often works out ok and at times makes sense to do, but it can easily lead to software flaws and doesn't do much to build a better undersanding of the domain which is necessary to solve more difficult challenges that don't fit into a Q&A format well.
There is a lot of knowledge that I don’t want to have expertise with. Sure, I could carefully read the PostgreSQL documentation about triggers and implement it myself, or I could get the job done in a few minutes and procrastinate on HN instead.
This approach can be hazardous to the health of the product you're building. For example, if you take this approach to answer the question of "what happens if I have two connections to a MySQL database, start a transaction in one of them and insert a row (but don't commit) and then issue a SELECT which would show the inserted row", then you will see consistent results across all of the experiments you run with that particular database, but you could easily end up with bugs that only show up when the transaction isolation level changes from how you tested it.
Whereas if you search for or ask that question, the answers you get will likely mention that transaction isolation levels are a thing.
You might also be able to get this level of knowledge by reading the manual, though there will still be things that are not included in the manual but do come up regularly in discussions on the wider internet.