diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:15:05 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 12:15:05 +0000 |
commit | 46651ce6fe013220ed397add242004d764fc0153 (patch) | |
tree | 6e5299f990f88e60174a1d3ae6e48eedd2688b2b /src/bin/psql/crosstabview.h | |
parent | Initial commit. (diff) | |
download | postgresql-14-46651ce6fe013220ed397add242004d764fc0153.tar.xz postgresql-14-46651ce6fe013220ed397add242004d764fc0153.zip |
Adding upstream version 14.5.upstream/14.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bin/psql/crosstabview.h')
-rw-r--r-- | src/bin/psql/crosstabview.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/bin/psql/crosstabview.h b/src/bin/psql/crosstabview.h new file mode 100644 index 0000000..53d0e41 --- /dev/null +++ b/src/bin/psql/crosstabview.h @@ -0,0 +1,29 @@ +/* + * psql - the PostgreSQL interactive terminal + * + * Copyright (c) 2000-2021, PostgreSQL Global Development Group + * + * src/bin/psql/crosstabview.h + */ + +#ifndef CROSSTABVIEW_H +#define CROSSTABVIEW_H + +#include "libpq-fe.h" + +/* + * Limit the number of output columns generated in memory by the crosstabview + * algorithm. A new output column is added for each distinct value found in the + * column that pivots (to form the horizontal header). + * The purpose of this limit is to fail early instead of over-allocating or spending + * too much time if the crosstab to generate happens to be unreasonably large + * (worst case: a NxN cartesian product with N=number of tuples). + * The value of 1600 corresponds to the maximum columns per table in storage, + * but it could be as much as INT_MAX theoretically. + */ +#define CROSSTABVIEW_MAX_COLUMNS 1600 + +/* prototypes */ +extern bool PrintResultsInCrosstab(const PGresult *res); + +#endif /* CROSSTABVIEW_H */ |