GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — View Editor Loses formatting between edits · Issue #9838 · pgadmin-org/pgadmin4

View Editor Loses formatting between edits #9838

New issue
Copy link
New issue
Copy link
Closed as not planned
Closed as not planned
View Editor Loses formatting between edits#9838
Copy link
Labels
Bug

Description

@TorsionTools
TorsionTools
opened on Apr 10, 2026
Issue body actions

Describe the bug

The formatting of the View editor is not retained between editing sessions.
This is especially annoying when it moves things that were put on separate lines for complex joins or concat and make them single lined and hard to read / see.

To Reproduce

Open the View Editor and us the automatic formatting CTRL + K.
Save
Open the View Editor again and the formatting has been lost.

Expected behavior

Formatting to be retained between saves.

Activity

  1. TorsionTools
    added
    Bug
    on Apr 10, 2026
  2. TorsionTools commented on Apr 20, 2026

    @TorsionTools
    TorsionTools
    on Apr 20, 2026
    Author
    More actions

    As a follow up to this, I have noticed in the latest version 9.14 that just using the auto formatting for the View editor will cause the view editor to throw an error and not let you save.

    Opened a view, used ctrl + K for formatting, tried to Save:
    Image

    Here are the formatting rules that are currently set.
    Image

  3. dpage
    added 2 commits that reference this issue on Oct 15, 2026

    Fix formatting a view's SQL being treated as a column change that dro…

    f8d762f

    Keep quoted identifiers intact and split at the FROM keyword when che…

    71d668c
  4. dpage commented on Oct 15, 2026

    @dpage
    dpage
    on Oct 15, 2026
    Contributor
    More actions

    There are two parts to this.

    The error when saving after Ctrl+K is fixed in #10591. The dialog checks whether an edited definition changes the view's columns by comparing the text before FROM, and that comparison was case-sensitive, so the formatter changing the case of function names, types or keywords looked like a column change and triggered the drop-and-recreate warning. The comparison now ignores case and formatting (outside quoted identifiers and string literals).

    Keeping your own formatting between edits isn't something pgAdmin can do, unfortunately. PostgreSQL doesn't store the text of a view's definition: it stores the parsed query, and pg_get_viewdef() rebuilds the SQL from that every time it's read, so line breaks, indentation and comments are lost as soon as the view is saved, whichever tool created it. The usual workaround is to keep the formatted source in a file or in version control.

  5. dpage
    added 11 commits that reference this issue on Oct 15, 2026

    Fix formatting a view's SQL being treated as a column change that dro…

    3f80e8c

    Keep quoted identifiers intact and split at the FROM keyword when che…

    c2adcc3

    Make the view reformat test independent of the PostgreSQL version. pg…

    5881fc4

    Fix formatting a view's SQL being treated as a column change that dro…

    fd4826c

    Keep quoted identifiers intact and split at the FROM keyword when che…

    2b96882

    Make the view reformat test independent of the PostgreSQL version. pg…

    6856622

    Fix formatting a view's SQL being treated as a column change that dro…

    6bb0c70

    Keep quoted identifiers intact and split at the FROM keyword when che…

    910d104

    Make the view reformat test independent of the PostgreSQL version. pg…

    d98bd48

    Skip SQL comments and dollar-quoted strings when checking view column…

    5d687fe

    Fix formatting a view's SQL being treated as a column change that dro…

    3530761
  6. dpage commented on Oct 15, 2026

    @dpage
    dpage
    on Oct 15, 2026
    Contributor
    More actions

    The follow-up bug, where reformatting a view's SQL was treated as a column change that dropped and re-created the view, is fixed in 3530761 (#10591).

    Keeping the view's original formatting isn't possible, however: PostgreSQL doesn't store the text of the view definition, only its parsed form, and pgAdmin reads it back with pg_get_viewdef(), which regenerates the SQL in PostgreSQL's own layout. Any formatting applied when the view was created is lost on the server side before pgAdmin ever sees it.

  7. dpage commented on Oct 16, 2026

    @dpage
    dpage
    on Oct 16, 2026
    Contributor
    More actions

    Closing: the follow-up bug is fixed in 3530761 (#10591), and keeping a view's original formatting isn't possible for the reason above.

  8. dpage
    closed this as not plannedon Oct 16, 2026
  9. asheshv
    added a commit that references this issue on Oct 26, 2026

    Skip the view msql tests that expect DROP VIEW on EPAS. (#10660)

    6d035dc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.