Re: How do I upsert depending on a second table?

2025-09-23 Thread Samuel Marks
questor is `owner` of associated `org` On Tue, Sep 23, 2025 at 3:57 PM Adrian Klaver wrote: > > On 9/23/25 13:36, Samuel Marks wrote: > > Attempt: > > ```sql > > CREATE TABLE org > > ( > > "name" VARCHAR(50) PRIMARY KEY, > > own

Re: How do I upsert depending on a second table?

2025-09-23 Thread Samuel Marks
E, you have the previous record > too. > There's much more control. > > Also, you can always count on the beloved foreign keys, which are also quite > useful. > > Atte. > JRBM > > > El mar, 23 sept 2025 a las 15:37, Samuel Marks () > escribió:

How do I upsert depending on a second table?

2025-09-23 Thread Samuel Marks
Attempt: ```sql CREATE TABLE org ( "name" VARCHAR(50) PRIMARY KEY, owner VARCHAR(50) NOT NULL ); CREATE TABLE repo ( "id" INTEGER PRIMARY KEY, full_name VARCHAR(255) UNIQUE NOT NULL, orgVARCHAR(50) NOT NULL REFERENCES org ("name") )

Re: How do I upsert depending on a second table?

2025-09-24 Thread Samuel Marks
through. It being a transaction lets me guarantee that at point of update or insert [upsert] the org owner matches the requestor. I would preference a single statement (one semicolon) solution; but for now at least this works 🤷 > > > > El mar, 23 sept 2025, 23:19, Samuel Marks > <