# sqlcmd-pg

> sqlcmd for PostgreSQL

Latest version **3.0.4** (published 2020-01-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install sqlcmd-pg
pnpm add sqlcmd-pg
yarn add sqlcmd-pg
bun add sqlcmd-pg
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.0.4 |
| Published | 2020-01-22 |
| First published | 2015-01-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 24.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Christopher Brown |
| Maintainers | chbrown |
| Keywords | sqlcmd, postgresql, pg |

## Links

- npm: https://www.npmjs.com/package/sqlcmd-pg
- Repository: https://github.com/chbrown/sqlcmd-pg
- Issues: https://github.com/chbrown/sqlcmd-pg/issues
- npm.io page: https://npm.io/package/sqlcmd-pg

## Dependencies (2)

- [pg](https://npm.io/package/pg.md) 6.2.5
- [sqlcmd](https://npm.io/package/sqlcmd.md) ^3.0.4

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 3.0.4 (latest) — 2020-01-22
- 3.0.2 — 2018-05-10
- 3.0.1 — 2018-03-05
- 3.0.0 — 2017-11-16
- 1.1.2 — 2016-01-24
- 1.1.1 — 2015-12-28
- 1.1.0 — 2015-12-27
- 1.0.2 — 2015-12-21
- 1.0.1 — 2015-12-12
- 1.0.0 — 2015-12-12
- 0.2.9 — 2015-07-06
- 0.2.8 — 2015-06-28
- 0.2.7 — 2015-06-25
- 0.2.6 — 2015-06-25
- 0.2.5 — 2015-06-10
- … 6 more at https://npm.io/package/sqlcmd-pg/versions

## README

[![Travis CI Build Status](https://travis-ci.org/chbrown/sqlcmd-pg.svg)](https://travis-ci.org/chbrown/sqlcmd-pg)

# sqlcmd-pg

[sqlcmd](https://github.com/chbrown/sqlcmd) for [PostgreSQL](http://www.postgresql.org/).

    npm install --save sqlcmd-pg

Or in your `package.json`:

    { ...
      "dependencies": {
        "sqlcmd-pg": "*",
        ...
      }
    }

Supports [PostgreSQL](http://www.postgresql.org/), via [pg](https://github.com/brianc/node-postgres).


## Configuration

With options object:

    var sqlcmd = require('sqlcmd-pg');

    var db = new sqlcmd.Connection({
      host: 'localhost',
      user: 'chbrown',
      database: 'friends',
    });

You can also use the connection string format:

    var db = new sqlcmd.Connection('postgres://chbrown@localhost/friends')

However, you must create the connection with the options object if you want to use any of the administrative helpers.


## Administrative helpers

The following helpers use the same connection options that were specified when creating the `db` connection, except it will connect to PostgreSQL's special `postgres` database instead of the database ("friends") we specified.

* `databaseExists` checks if the database exists by looking at the `pg_catalog.pg_database` table.
* `createDatabase` issues a `CREATE DATABASE ...` command.
* `dropDatabase` issues a `DROP DATABASE ...` command.

These commands are all unsafe; they are vulnerable to SQL injection via the database name.


## License

Copyright 2015 Christopher Brown. [MIT Licensed](http://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/sqlcmd-pg · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
