Skip to content

Support editing rows in tables whose primary key is a composite type. #1217

@mk-pmb

Description

@mk-pmb

Thanks a lot for Adminer!

Adminer version: 5.4.1
Compiled: docker pull adminer:latest
Driver: postgres
Database version: PostgreSQL 17.2
Plugins used:

DROP TYPE IF EXISTS public.yolo_version_id CASCADE;
CREATE TYPE public.yolo_version_id AS (
    baseid character varying,
    vernum smallint);

DROP TABLE IF EXISTS "public"."yolo_data" CASCADE;
CREATE TABLE "public"."yolo_data" (
    "versid" public.yolo_version_id PRIMARY KEY,
    "time_created" timestamptz(3) NOT NULL,
    "details" json NOT NULL) WITH (oids = false);

INSERT INTO "yolo_data" ("versid", "time_created", "details") VALUES
  (('yolo-test', 1), '2025-11-24T06:00:00Z', '{"foo":1}')
  ON CONFLICT DO NOTHING;

UPDATE "yolo_data" SET "details" = '{"bar":2}' WHERE "versid"::text = '(yolo-test,1)';

SELECT * FROM "yolo_data" WHERE "versid"::text = '(yolo-test,1)';

Unfortunately, in the latest adminer, you can no longer just click the "versid" value in the SELECT result to edit the row. (In Adminer v4.8.1 the link is there.)
So instead, in the navigation bar, click "select" next to "yolo_data", and in the left of the single row, click "edit".

ERROR: input of anonymous composite types is not implemented
LINE 3: WHERE "versid" = '(yolo-test,1)'

Could you make it so when the right side of the comparison is a string, the left side is converted to ::text?
If you can easily detect whether the column checked is a composite type, maybe you can even restrict it to those cases.
Or maybe there is an even better way to determine whether the left side is some kind of text already, to not waste performance in simple scenarios. If nothing like that is practical, maybe just a config switch? I can easily afford a ton of redundant ::text conversions on my dev machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions