pgschema icon indicating copy to clipboard operation
pgschema copied to clipboard

Issue with camelcase column names

Open henrikradandt opened this issue 9 months ago • 2 comments

Hello,

I have a problem with column names in camelcase. As recommended in issue https://github.com/pgplex/pgschema/issues/14, I have created a JSON-plan. The plan escapes correctly in nearby every case, except one step that doesn't escape the column name (last one in the code snippet). Therefore an apply will fail because of an invalid name.

{
          "sql": "ALTER TABLE \"hpd_eventPlanning\".\"Planning\" ADD CONSTRAINT \"offersValidUntil_not_null\" CHECK (offersValidUntil IS NOT NULL) NOT VALID;",
          "type": "table.column",
          "operation": "alter",
          "path": "hpd_eventPlanning.Planning.offersValidUntil"
        },
        {
          "sql": "ALTER TABLE \"hpd_eventPlanning\".\"Planning\" VALIDATE CONSTRAINT \"offersValidUntil_not_null\";",
          "type": "table.column",
          "operation": "alter",
          "path": "hpd_eventPlanning.Planning.offersValidUntil"
        },
        {
          "sql": "ALTER TABLE \"hpd_eventPlanning\".\"Planning\" ALTER COLUMN offersValidUntil SET NOT NULL;",
          "type": "table.column",
          "operation": "alter",
          "path": "hpd_eventPlanning.Planning.offersValidUntil"
        },

I'm using the latest release of pgschema.

Thanks in advance

henrikradandt avatar Feb 23 '26 11:02 henrikradandt

Found another occurence of an unescaped colum name (with the CHECK):

{
          "sql": "ALTER TABLE \"hpd_eventPlanning\".\"Planning\" ADD CONSTRAINT \"offersValidUntil_not_null\" CHECK (offersValidUntil IS NOT NULL) NOT VALID;",
          "type": "table.column",
          "operation": "alter",
          "path": "hpd_eventPlanning.Planning.offersValidUntil"
        },

henrikradandt avatar Feb 23 '26 11:02 henrikradandt

Thanks a lot 👍

henrikradandt avatar Feb 23 '26 16:02 henrikradandt