Pages table is f*cked up

Issue #4 resolved
Jelmer van der Linde created an issue

Run this query:

SELECT
    p.id, p.titel,
    COUNT(p2.id)
FROM
    pages p
LEFT JOIN pages p2 ON
    p.id = p2.id
    AND p.owner = p2.owner
    AND p.titel = p2.titel
    AND p.content = p2.content
    AND p.content_en = p2.content_en
    AND p.content_de = p2.content_de
GROUP BY
    p.id, p.titel,
    p.owner, p.content,
    p.content_en, p.content_de

and look in pain at all those duplicates! Who forgot to make id the primary key :(

Comments (5)

  1. Arryon Tijsma

    Doesn't look like a bug to me, just unwanted complexity because of bad database design. Can you give an example of how this hinders working with the website? If it's really bothering, we could create a primary key on id.

  2. Jelmer van der Linde reporter

    It is not causing any trouble and it is probably more work to clean up than it is to just leave it alone till it is replaced by something better.

  3. Jelmer van der Linde reporter
    • changed status to open

    If we add a primary key we can apparently edit the table more easily in phppgadmin.

  4. Jelmer van der Linde reporter

    Created a clean copy of the pages table and added a primary key. And directly fixed some pages that had multiple 'pages'. (Something that cannot be removed using the website itself.)

  5. Log in to comment