add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
create table TableA
(
Id serial PRIMARY KEY,
Name CHARACTER varying(30),
tableB_Id INTEGER
);

insert into TableA VALUES (11, 'Name A', NULL), (22, 'Name B', NULL);

create table TableB
(
Id serial PRIMARY KEY,
Name CHARACTER varying(30),
Descr CHARACTER(30)
);

INSERT INTO TableB VALUES
(123, 'Name A', 'Desc A'),
(456, 'Name X', 'Desc X'),
(789, 'Name B', 'Desc B');
CREATE TABLE
INSERT 0 2
CREATE TABLE
INSERT 0 3
UPDATE TableA
SET tableB_Id = TableB.Id
FROM TableB
WHERE TableA.Name = TableB.Name;
UPDATE 2
SELECT * FROM TableA
id name tableb_id
11 Name A 123
22 Name B 789
SELECT 2