# ut-port-postgres

> UT Port PostgreSQL Module

Latest version **5.8.3** (published 2020-01-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install ut-port-postgres
pnpm add ut-port-postgres
yarn add ut-port-postgres
bun add ut-port-postgres
```

## 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 | 5.8.3 |
| Published | 2020-01-17 |
| First published | 2016-08-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 216.2 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | kalin.krustev |

## Links

- npm: https://www.npmjs.com/package/ut-port-postgres
- Repository: https://github.com/softwaregroup-bg/ut-port-postgres
- Homepage: https://github.com/softwaregroup-bg/ut-port-postgres#readme
- Issues: https://github.com/softwaregroup-bg/ut-port-postgres/issues
- npm.io page: https://npm.io/package/ut-port-postgres

## Dependencies (2)

- [ut-error](https://npm.io/package/ut-error.md) ^5.4.9
- [pg-promise](https://npm.io/package/pg-promise.md) 5.3.1

## Recent versions

- 5.8.3 (latest) — 2020-01-17
- 5.8.0-rc-godfather.5 (rc-godfather) — 2019-01-18
- 5.7.12-noWhen.0 (ci) — 2017-08-01
- 5.8.2 — 2019-03-22
- 5.8.1 — 2019-02-19
- 5.8.0 — 2019-02-02
- 5.8.0-rc-godfather.4 — 2019-01-07
- 5.8.0-rc-godfather.3 — 2019-01-07
- 5.8.0-rc-godfather.2 — 2018-11-30
- 5.8.0-rc-godfather.1 — 2018-11-15
- 5.8.0-rc-godfather.0 — 2018-10-26
- 5.7.11 — 2017-05-22
- 5.7.10 — 2017-05-22
- 5.7.9 — 2017-05-22
- 5.7.8 — 2017-04-24
- … 18 more at https://npm.io/package/ut-port-postgres/versions

## README

# **Postgres Port:** `ut-port-postgres`

## Returning multiple result sets

If there is need to return data from several unrelated queries, the following
pattern can be used. If we have the queries q1 and q2 (each one is any valid
select statement represented with SELECT 1 and SELECT 2 below), then the
following can be executed:

```sql
WITH
    q1 AS (SELECT 1),
    q2 AS (SELECT 2)
SELECT
    (SELECT json_agg(q1) FROM q1) AS q1,
    (SELECT json_agg(q2) FROM q2) AS q2
```

This query can be used as result from a function with the following signature:

```sql
CREATE FUNCTION f1() RETURNS TABLE(q1 json, q2 json) AS
```

The result returned by the port will be JSON with the following structure:

```json
{
    "q1":[],
    "q2":[]
}
```

This basically returns two result sets as properties in one object. Each result
set is array of objects, where each object represents one row from the query.

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