IANAL, but calling this "relicensing" is technically inaccurate. It is more precise to describe it as adding constraints. When you combine your work with upstream code, you are layering additional requirements (like copyleft) onto the existing attribution requirements. The original limitations remain in effect. Therefore, it is not a shift from A to B, but rather from A to A ∪ B.
This practice is entirely compatible with the PostgreSQL License, but it is often prohibited by GPL variants. You typically cannot combine GPL code with code under most other copyleft licenses, such as the Eclipse Public License.
Regarding copyright status, AI-assisted work is increasingly recognized as copyrightable in many jurisdictions, provided the process involves a sufficient level of human creative input (though the specific threshold varies by jurisdiction). Only work generated purely by AI, with no human involvement, is arguably public domain. In a case like this, which is akin to "pair programming," the output is almost certainly copyrightable.
IAAL (not legal advice) and I’m not sure the issue is settled.
The BSD license only explicitly permits the author “to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement.”
By default, the owner of a protected work retains all rights not conveyed to someone else. Changing the license isn’t one of the enumerated activities, and so I think there’s a case to be made that it’s not permitted.
Now if the author wants to claim it’s a new work, as opposed to a modification (which opens up a big bag of issues by itself because this was AI-authored), then the author can license it however they see fit.
You are not really changing the license of the original work though. You are not impacting what the author or anyone else can do. You are distributing a copy under different, more restrictive terms.
A bit like me buying a comic book, then offering to sell it to you under the condition that you never let my brother read it and that you make any future owner agree to the same terms. That's perfectly legal, and there is no reason I would need permission from the author (or publisher) to do that
A comic book is a physical object. This analogy doesn’t hold. When you give a comic book to someone, you’re only transferring the copy and its implied license that carries with it. You can set the terms of the physical object, but you can’t change the license of the content within it.
Suppose you get a license to view a copy of a work (streaming or a paid subscription to a newspaper site). Your permission to consume the media begins and ends with the license terms, which allow you to view the work (and, since it’s necessary, to make a transient copy) during the period of the subscription. You don’t get to relicense it to someone else under those terms.
Your redistribution license only applies to the part you own copyright on. Everything else is still under the original license. You can add AGPL but that doesn't take away the BSD license from the parts you didn't create.
I’m not sure it’s so easily severable in this case.