CYBERTEC Logo

PostgreSQL Vim integration: Finally ...

09.2013 / Category: / Tags: |

Last time I came up with the idea of writing some Vim script for PostgreSQL so that people can edit data fast and easily directly in Vim. The goal is to export a table directly to Vim, modify it and load it back in. This can come in handy when you want to edit a configuration table or some other small data set. Using INSERT / UPDATE / DELETE can be quite a lot of work.

Importing into Vim is basically not too much of an issue – but, exporting data back to PostgreSQL has kept me and my fellow here in office (Attila Max Ruf) pretty occupied mentally.

The weekend has finally left us with the following procedures:

The PSQLInit call will initialize the editor and provide information about where to find what and so on. Then there is PSQLCopyTable to load the data from PostgreSQL to Vim (in COPY format). Once you have edited the data you can call PSQLCopySave to pump the data back in.

Note that this will simply replace the content of the entire table.

Btw, you can test those modules. Just go to http://pgfoundry.org/snippet/detail.php?type=package&id=2 and follow the instructions in the README file.

Visit us on facebook: www.fb.com/cybertec.postgresql

Comments are closed.

CYBERTEC Logo white
CYBERTEC PostgreSQL International GmbH
Römerstraße 19
2752 Wöllersdorf
Austria

+43 (0) 2622 93022-0
office@cybertec.at

Get the newest PostgreSQL Info & Tools


    This site is protected by reCAPTCHA and the Google Privacy Policy & Terms of Service apply.

    ©
    2024
    CYBERTEC PostgreSQL International GmbH
    phone-handsetmagnifiercrosscross-circle linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram