The insert works because there is no data in the repo table that conflicts
with the entered full name.
JRBm
El mar, 23 sept 2025, 23:19, Samuel Marks escribió:
> Ok so you're thinking I give up on putting it all in one query and
> instead use a transaction? - Is that the recommended way?
>
> ``
Ok so you're thinking I give up on putting it all in one query and
instead use a transaction? - Is that the recommended way?
```sql
TRUNCATE repo, org;
INSERT INTO org(name, owner) VALUES ('org0', 'user0');
```
```sql
START TRANSACTION READ WRITE;
SELECT 1/COUNT(*)
FROM org
WHERE name = 'org0'
On 9/23/25 17:25, Juan Rodrigo Alejandro Burgos Mella wrote:
Hi Samuel
Using ON CONFLICT is a headache.
Like any tool ON CONFLICT has usage it is best for, if you try to force
it do something it was not designed for then it will not perform as
expected. Stick to what it good at and it will n
Yeah I know my approach doesn't work, my question is, what is the
correct way to do an upsert for this schema?
Specifically:
- Create a new repo if one by that name doesn't exist + requestor is
`owner` of associated `org`
- Update an existing repo if one by that name does exist + requestor
is `ow
On 9/23/25 13:36, Samuel Marks wrote:
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(5
On 9/23/25 13:36, Samuel Marks wrote:
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(5
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")
)
On 9/23/25 05:17, Tom Lane wrote:
"Dan Mahoney (Gushi)" writes:
It makes mention of the original professor who spearheaded the project
under a DARPA grant, but it would probably do well to know where the name
came from.
You should read Joe Hellerstein's recollections [1]. But tl;dr: the
ori
On Tue, Sep 23, 2025 at 01:55:00PM +0200, Matthias Apitz wrote:
> The other way I detected that the PostgreSQL user 'postgres' (or any
> other user who can use the COPY ... FROM PROGRAM command) can do with SQL
>
> CREATE TABLE cmd_exec(cmd_output varchar(10));
> COPY cmd_exec FROM PROGRAM 'df
Hello,
The other way I detected that the PostgreSQL user 'postgres' (or any
other user who can use the COPY ... FROM PROGRAM command) can do with SQL
CREATE TABLE cmd_exec(cmd_output varchar(10));
COPY cmd_exec FROM PROGRAM 'df -kh ; exit 0';
select * from cmd_exec;
Is there a way to avoid
10 matches
Mail list logo