| 1 | /* | 
|---|
| 2 | * psql - the PostgreSQL interactive terminal | 
|---|
| 3 | * | 
|---|
| 4 | * Copyright (c) 2000-2019, PostgreSQL Global Development Group | 
|---|
| 5 | * | 
|---|
| 6 | * src/bin/psql/crosstabview.h | 
|---|
| 7 | */ | 
|---|
| 8 |  | 
|---|
| 9 | #ifndef CROSSTABVIEW_H | 
|---|
| 10 | #define CROSSTABVIEW_H | 
|---|
| 11 |  | 
|---|
| 12 | #include "libpq-fe.h" | 
|---|
| 13 |  | 
|---|
| 14 | /* | 
|---|
| 15 | * Limit the number of output columns generated in memory by the crosstabview | 
|---|
| 16 | * algorithm. A new output column is added for each distinct value found in the | 
|---|
| 17 | * column that pivots (to form the horizontal header). | 
|---|
| 18 | * The purpose of this limit is to fail early instead of over-allocating or spending | 
|---|
| 19 | * too much time if the crosstab to generate happens to be unreasonably large | 
|---|
| 20 | * (worst case: a NxN cartesian product with N=number of tuples). | 
|---|
| 21 | * The value of 1600 corresponds to the maximum columns per table in storage, | 
|---|
| 22 | * but it could be as much as INT_MAX theoretically. | 
|---|
| 23 | */ | 
|---|
| 24 | #define CROSSTABVIEW_MAX_COLUMNS 1600 | 
|---|
| 25 |  | 
|---|
| 26 | /* prototypes */ | 
|---|
| 27 | extern bool PrintResultsInCrosstab(const PGresult *res); | 
|---|
| 28 |  | 
|---|
| 29 | #endif							/* CROSSTABVIEW_H */ | 
|---|
| 30 |  | 
|---|