Showing preview only (8,383K chars total). Download the full file or copy to clipboard to get everything.
Repository: pgspider/sqlite_fdw
Branch: master
Commit: ea52a24f63dd
Files: 208
Total size: 7.8 MB
Directory structure:
gitextract_jct4ly9d/
├── .dockerignore
├── .gitattributes
├── .github/
│ └── workflows/
│ └── CI.yml
├── .gitignore
├── GIS.md
├── GitHubActions/
│ ├── README.md
│ ├── build_postgis.sh
│ ├── build_postgres.sh
│ ├── build_sqlite_fdw.sh
│ ├── detect_targets.sh
│ ├── download_postgis.sh
│ ├── env.sh
│ ├── execute_test.sh
│ ├── install_locales.sh
│ └── install_sqlite.sh
├── License
├── META.json
├── Makefile
├── README.md
├── connection.c
├── deparse.c
├── option.c
├── sql/
│ ├── 13.15/
│ │ ├── aggregate.sql
│ │ ├── extra/
│ │ │ ├── aggregates.sql
│ │ │ ├── encodings.sql
│ │ │ ├── insert.sql
│ │ │ ├── join.sql
│ │ │ ├── limit.sql
│ │ │ ├── prepare.sql
│ │ │ ├── select.sql
│ │ │ ├── select_having.sql
│ │ │ ├── sqlite_fdw_post.sql
│ │ │ └── update.sql
│ │ ├── libsqlite.sql
│ │ ├── selectfunc.sql
│ │ ├── sqlite_fdw.sql
│ │ ├── types/
│ │ │ ├── bitstring.sql
│ │ │ ├── bool.sql
│ │ │ ├── float4.sql
│ │ │ ├── float8.sql
│ │ │ ├── int4.sql
│ │ │ ├── int8.sql
│ │ │ ├── json.sql
│ │ │ ├── macaddr.sql
│ │ │ ├── macaddr8.sql
│ │ │ ├── numeric.sql
│ │ │ ├── out_of_range.sql
│ │ │ ├── timestamp.sql
│ │ │ └── uuid.sql
│ │ ├── with_gis_support/
│ │ │ ├── auto_import.sql
│ │ │ ├── postgis.sql
│ │ │ └── type.sql
│ │ └── without_gis_support/
│ │ ├── auto_import.sql
│ │ ├── nogis.sql
│ │ └── type.sql
│ ├── 14.12/
│ │ ├── aggregate.sql
│ │ ├── extra/
│ │ │ ├── aggregates.sql
│ │ │ ├── encodings.sql
│ │ │ ├── insert.sql
│ │ │ ├── join.sql
│ │ │ ├── limit.sql
│ │ │ ├── prepare.sql
│ │ │ ├── select.sql
│ │ │ ├── select_having.sql
│ │ │ ├── sqlite_fdw_post.sql
│ │ │ └── update.sql
│ │ ├── libsqlite.sql
│ │ ├── selectfunc.sql
│ │ ├── sqlite_fdw.sql
│ │ ├── types/
│ │ │ ├── bitstring.sql
│ │ │ ├── bool.sql
│ │ │ ├── float4.sql
│ │ │ ├── float8.sql
│ │ │ ├── int4.sql
│ │ │ ├── int8.sql
│ │ │ ├── json.sql
│ │ │ ├── macaddr.sql
│ │ │ ├── macaddr8.sql
│ │ │ ├── numeric.sql
│ │ │ ├── out_of_range.sql
│ │ │ ├── timestamp.sql
│ │ │ └── uuid.sql
│ │ ├── with_gis_support/
│ │ │ ├── auto_import.sql
│ │ │ ├── postgis.sql
│ │ │ └── type.sql
│ │ └── without_gis_support/
│ │ ├── auto_import.sql
│ │ ├── nogis.sql
│ │ └── type.sql
│ ├── 15.7/
│ │ ├── aggregate.sql
│ │ ├── extra/
│ │ │ ├── aggregates.sql
│ │ │ ├── encodings.sql
│ │ │ ├── insert.sql
│ │ │ ├── join.sql
│ │ │ ├── limit.sql
│ │ │ ├── prepare.sql
│ │ │ ├── select.sql
│ │ │ ├── select_having.sql
│ │ │ ├── sqlite_fdw_post.sql
│ │ │ └── update.sql
│ │ ├── libsqlite.sql
│ │ ├── selectfunc.sql
│ │ ├── sqlite_fdw.sql
│ │ ├── types/
│ │ │ ├── bitstring.sql
│ │ │ ├── bool.sql
│ │ │ ├── float4.sql
│ │ │ ├── float8.sql
│ │ │ ├── int4.sql
│ │ │ ├── int8.sql
│ │ │ ├── json.sql
│ │ │ ├── macaddr.sql
│ │ │ ├── macaddr8.sql
│ │ │ ├── numeric.sql
│ │ │ ├── out_of_range.sql
│ │ │ ├── timestamp.sql
│ │ │ └── uuid.sql
│ │ ├── with_gis_support/
│ │ │ ├── auto_import.sql
│ │ │ ├── postgis.sql
│ │ │ └── type.sql
│ │ └── without_gis_support/
│ │ ├── auto_import.sql
│ │ ├── nogis.sql
│ │ └── type.sql
│ ├── 16.3/
│ │ ├── aggregate.sql
│ │ ├── extra/
│ │ │ ├── aggregates.sql
│ │ │ ├── encodings.sql
│ │ │ ├── insert.sql
│ │ │ ├── join.sql
│ │ │ ├── limit.sql
│ │ │ ├── prepare.sql
│ │ │ ├── select.sql
│ │ │ ├── select_having.sql
│ │ │ ├── sqlite_fdw_post.sql
│ │ │ └── update.sql
│ │ ├── libsqlite.sql
│ │ ├── selectfunc.sql
│ │ ├── sqlite_fdw.sql
│ │ ├── types/
│ │ │ ├── bitstring.sql
│ │ │ ├── bool.sql
│ │ │ ├── float4.sql
│ │ │ ├── float8.sql
│ │ │ ├── int4.sql
│ │ │ ├── int8.sql
│ │ │ ├── json.sql
│ │ │ ├── macaddr.sql
│ │ │ ├── macaddr8.sql
│ │ │ ├── numeric.sql
│ │ │ ├── out_of_range.sql
│ │ │ ├── timestamp.sql
│ │ │ └── uuid.sql
│ │ ├── with_gis_support/
│ │ │ ├── auto_import.sql
│ │ │ ├── postgis.sql
│ │ │ └── type.sql
│ │ └── without_gis_support/
│ │ ├── auto_import.sql
│ │ ├── nogis.sql
│ │ └── type.sql
│ ├── 17.0/
│ │ ├── aggregate.sql
│ │ ├── extra/
│ │ │ ├── aggregates.sql
│ │ │ ├── encodings.sql
│ │ │ ├── insert.sql
│ │ │ ├── join.sql
│ │ │ ├── limit.sql
│ │ │ ├── prepare.sql
│ │ │ ├── select.sql
│ │ │ ├── select_having.sql
│ │ │ ├── sqlite_fdw_post.sql
│ │ │ └── update.sql
│ │ ├── libsqlite.sql
│ │ ├── selectfunc.sql
│ │ ├── sqlite_fdw.sql
│ │ ├── types/
│ │ │ ├── bitstring.sql
│ │ │ ├── bool.sql
│ │ │ ├── float4.sql
│ │ │ ├── float8.sql
│ │ │ ├── int4.sql
│ │ │ ├── int8.sql
│ │ │ ├── json.sql
│ │ │ ├── macaddr.sql
│ │ │ ├── macaddr8.sql
│ │ │ ├── numeric.sql
│ │ │ ├── out_of_range.sql
│ │ │ ├── timestamp.sql
│ │ │ └── uuid.sql
│ │ ├── with_gis_support/
│ │ │ ├── auto_import.sql
│ │ │ ├── postgis.sql
│ │ │ └── type.sql
│ │ └── without_gis_support/
│ │ ├── auto_import.sql
│ │ ├── nogis.sql
│ │ └── type.sql
│ └── init_data/
│ ├── agg.data
│ ├── datetimes.data
│ ├── init.sql
│ ├── init_core.sql
│ ├── init_post.sql
│ ├── init_selectfunc.sql
│ ├── onek.data
│ ├── person.data
│ ├── streets.data
│ ├── student.data
│ └── tenk.data
├── sqlite_data_norm.c
├── sqlite_fdw--1.0--1.1.sql
├── sqlite_fdw--1.0.sql
├── sqlite_fdw.c
├── sqlite_fdw.control
├── sqlite_fdw.h
├── sqlite_fdw.vcxproj
├── sqlite_gis.c
├── sqlite_query.c
└── test.sh
================================================
FILE CONTENTS
================================================
================================================
FILE: .dockerignore
================================================
*.sh
fdw_rpm_with_pgspider/
fdw_rpm_with_postgres/
================================================
FILE: .gitattributes
================================================
*.c linguist-detectable=true
*.h linguist-detectable=true
expected/* linguist-detectable=false
sql/* linguist-detectable=false
*.md linguist-documentation
================================================
FILE: .github/workflows/CI.yml
================================================
name: SQLite FDW test
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- main
jobs:
detect-pgversion:
runs-on: ubuntu-22.04
outputs:
pgversion: ${{ steps.detect-pgversion.outputs.targets }}
steps:
- uses: actions/checkout@v4
- name: detect-pgversion
id: detect-pgversion
run: |
targets=`bash GitHubActions/detect_targets.sh`
echo "targets=$targets" >> $GITHUB_OUTPUT
test:
needs: detect-pgversion
env:
SQLITE_VERSION : "3490000"
SQLITE_YEAR: "2025"
POSTGIS_VERSION : "3.4.2"
HTTP_PROXY: ""
HTTPS_PROXY: ""
SQLITE_FOR_TESTING_DIR: "/opt/CI_sqlite"
strategy:
fail-fast: false
matrix:
pg: ${{ fromJSON(needs.detect-pgversion.outputs.pgversion) }}
config: ["default", "postgis"]
name: Test on PostgreSQL ${{ matrix.pg }}, ${{ matrix.config }} mode
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: tar
run: tar zcvf sqlite_fdw.tar.gz ./*
- name: set_proxy
run: bash GitHubActions/env.sh
- name: download PostGIS, ${{ matrix.config }} mode
run: |
if [[ "${{ matrix.config }}" == "postgis" ]]; then
bash GitHubActions/download_postgis.sh ${{ env.POSTGIS_VERSION }}
fi
- name: install locales
run: bash GitHubActions/install_locales.sh
- name: build PostgreSQL ${{ matrix.pg }}
run: bash GitHubActions/build_postgres.sh ${{ matrix.pg }}
- name: install SQLite, ${{ matrix.config }} mode
run: |
if [[ "${{ matrix.config }}" == "default" ]]; then
bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }}
elif [[ "${{ matrix.config }}" == "postgis" ]]; then
bash GitHubActions/install_sqlite.sh ${{ env.SQLITE_VERSION }} ${{ env.SQLITE_YEAR }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }} --enable-rtree
fi
- name: build PostGIS ${{ env.POSTGIS_VERSION }} for PostgreSQL ${{ matrix.pg }}, ${{ matrix.config }} mode
run: |
if [[ "${{ matrix.config }}" == "postgis" ]]; then
bash GitHubActions/build_postgis.sh ${{ matrix.pg }} ${{ env.POSTGIS_VERSION }}
fi
- name: build sqlite_fdw, ${{ matrix.config }} mode
run: |
bash GitHubActions/build_sqlite_fdw.sh ${{ matrix.pg }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }}
- name: execute sqlite_fdw test
run: bash GitHubActions/execute_test.sh ${{ matrix.pg }} ${{ matrix.config }} ${{ env.SQLITE_FOR_TESTING_DIR }}
- name: download output files (regression.diffs)
if: failure()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.pg }}-${{ matrix.config }}-test-results
path: |
workdir/postgresql-${{ matrix.pg }}/contrib/sqlite_fdw/regression.diffs
workdir/postgresql-${{ matrix.pg }}/contrib/sqlite_fdw/regression.out
workdir/postgresql-${{ matrix.pg }}/contrib/sqlite_fdw/results
retention-days: 7
================================================
FILE: .gitignore
================================================
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Log files
log/
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
# Visual Studio related
.vs/
x64/
Debug/
Release/
================================================
FILE: GIS.md
================================================
GIS support in SQLite Foreign Data Wrapper for PostgreSQL
=========================================================
<img src="https://www.tmapy.cz/wp-content/uploads/2021/02/postgis-logo.png" align="center" height="80" alt="PostGIS"/> + <img src="https://www.gaia-gis.it/fossil/libspatialite/logo" align="center" height="80" alt="SpatiaLite"/>
SQLite FDW for PostgreSQL can connect PostgreSQL with or without [PostGIS](https://www.postgis.net/)
to [SpatiaLite](https://www.gaia-gis.it/fossil/libspatialite/index) SQLite database file.
This description contains only information about GIS support without common SQL and
system descriptions from [common FDW description](README.md).
Notes about compilation environment and PROJ library
----------------------------------------------------
Both SpatiaLite and PostGIS uses [PROJ C++ library](https://github.com/OSGeo/PROJ) from
[Open Source Geospatial Foundation](https://github.com/OSGeo) for reprojecting and some calculations.
Recommended configuration of SQLite FDW with GIS support contains both SpatiaLite and PostGIS.
**It is recommended to install only 1 version of PROJ in a system to avoid integration issue**.
Before compilation you should ensure equal versions of PROJ library required by SpatiaLite and PostGIS on
your system. Otherwise some encapsualted and unwanted memory freeing errors can occur.
If you need different PROJ library versions, you can reference [this PROJ issue](https://github.com/OSGeo/PROJ/issues/4361)
and try to use something like `CFLAGS="$CFLAGS -DPROJ_RENAME_SYMBOLS -O2"` during compilation of
SpatiaLite or PostGIS to link one of this extensions with other PROJ version.
Common conditions of GIS support
--------------------------------
1. SQLite FDW should be compiled with `ENABLE_GIS=1` environment variable value.
2. You must install SpatiaLite header files before compilation.
Linux packages like `libspatialite-dev` or `libspatialite-devel` can contain this files.
3. A column should have data type (domain) name from following list:
* addbandarg
* box2d
* box3d
* geography
* geometry
* geometry_dump
* geomval
* getfaceedges_returntype
* rastbandarg
* raster
* reclassarg
* summarystats
* topoelement
* topoelementarray
* topogeometry
* unionarg
* validatetopology_returntype
Only listed data types have full data transformation support:
* geography
* geometry
All other data types (domains) are treated as PostGIS specific, but unsupported.
You can use SpatiaLite GIS data support _without PostGIS installation_ after such
SQL commands as `CREATE DOMAIN geometry AS bytea;` and `CREATE DOMAIN geography AS bytea;`.
This allows to have in PostgreSQL PostGIS compatible `bytea` data easy
convertable to PostGIS storage format.
PostGIS and SpatiaLite vector data formats
-------------------------------------------
Vector GIS data in PostGIS can be stored in a columns with `geography` or `geometry`
data type. This columns contains a binary data.
[Well-known binary (WKB)](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Well-known_binary)
data storage format is a standard of [Open Geospatial Consortium (OGC)](https://en.wikipedia.org/wiki/Open_Geospatial_Consortium)
and supported by [GEOS library](https://libgeos.org). PostGIS internal GIS data
storage format based on WKB with [SRID](https://en.wikipedia.org/wiki/Spatial_reference_system#Identifiers)
additions. This format is known as [EWKB](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry#Format_variations) and supported by
[GEOS library](https://libgeos.org) and SpatiaLite input/output functions.
Hexadecimal text representation of EWKB data is a transport form for `geography`
and `geometry` GIS data between PostgreSQL and *SpatiLite input/output functions*.
Hence no PostGIS input/output functions are necessary, but all of this functions
are supported.
EWKB hexadecimal text data transport is faster than
[EWKT](https://en.wikipedia.org/wiki/Well-known_text_representation_of_geometry)
but slower than EWKB blob data transport.
SpatiaLite internal storage based on `blob` data [affinity](https://www.sqlite.org/datatype3.html)
and is not a standard of [OGC](https://en.wikipedia.org/wiki/Open_Geospatial_Consortium).
Also this format doesn't supported by [GEOS library](https://libgeos.org).
Limitations
-----------
* In opposition to PostGIS, **SpatiaLite doesn't allow to store any GIS vector data without SRID**.
Hence any well-formed SpatiaLite data can be converted for PostGIS, but
well-formed PostGIS data _without SRID_ cannot be converted for SpatiaLite.
All of SpatiaLite input functions will return `NULL` in this case.
Please use [ST_SetSRID PostGIS function](https://postgis.net/docs/ST_SetSRID.html)
in case of incomplete SRID data to prepare PostGIS data for importing to SpatiaLite
or comparing with SpatiaLite data.
* Only `=` PostgreSQL operator is pushed down to SQLite (SpatiaLite) for vector GIS data such
as `geography` or `geometry`. `<>` PostgreSQL operator is NOT pushed down.
End of description.
================================================
FILE: GitHubActions/README.md
================================================
# CI environment of sqlite_fdw.
Tests will be executed automatically when commited to main/master branch and when a pull request was opened/updated.
It is realized by using GitHub actions.
The CI process is defined in .github/workflows/CI.yml file.
Scripts in this directory (GitHubActions/*.sh) are referred by CI.yml.
The regression test will be executed for multi-versions of PostgreSQL.
Target versions are determined automatically based on directory names in "sql" directory.
If the regression test failed, test result files (result directory, regression.diff amd regression.out) are uploaded as artifacts.
7 days later, artifact files will be deleted.
================================================
FILE: GitHubActions/build_postgis.sh
================================================
#!/bin/bash
################################################################################
#
# This script downloads PostGIS from the official web site into ./workdir
# then builds it.
#
# Usage: ./build_postgis.sh pg_version postgis_version
# pg_version is a PostgreSQL version to be installed like 16.0.
# postgis_version is a PostGIS version to be installed.
#
# Requirements
# - be able to connect to the PostGIS official web site by wget.
#
################################################################################
POSTGRESQL_VERSION=$1
POSTGIS_VERSION=$2
# Install necessary dependencies
sudo apt update
sudo apt install -y build-essential libxml2-dev libgeos-dev libproj-dev libgdal-dev libjson-c-dev libprotobuf-c-dev protobuf-c-compiler
cd ./workdir
# Download and compile PostGIS
cp -vr postgis postgresql-${POSTGRESQL_VERSION}/contrib
cd postgresql-${POSTGRESQL_VERSION}/contrib/postgis
echo " - PostGIS directory"
GEOS_CONFIG_PATH=$(which geos-config)
export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH
./configure --with-pgconfig=/usr/local/pgsql/bin/pg_config --with-geosconfig=$GEOS_CONFIG_PATH
make
sudo make install
================================================
FILE: GitHubActions/build_postgres.sh
================================================
#!/bin/bash
################################################################################
#
# This script downloads PostgreSQL from the official web site into ./workdir
# then builds it.
#
# Usage: ./build_postgres.sh pg_version [configure_options]
# pg_version is a PostgreSQL version to be installed like 17.0.
# configure_options are a list of option for postgres server.
#
# Requirements
# - be able to connect to the PostgreSQL official web site by curl.
#
################################################################################
POSTGRESQL_VERSION=$1
CONFIGURE_OPTIONS=""
while (( "$#" )); do
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS $2"
shift
done
mkdir -p ./workdir
cd ./workdir
curl -O https://ftp.postgresql.org/pub/source/v${POSTGRESQL_VERSION}/postgresql-${POSTGRESQL_VERSION}.tar.bz2
tar xjf postgresql-${POSTGRESQL_VERSION}.tar.bz2
cd postgresql-${POSTGRESQL_VERSION}
if [ -z "$CONFIGURE_OPTIONS" ]; then
./configure
else
./configure $CONFIGURE_OPTIONS
fi
make
sudo make install
sudo chown -R $USER /usr/local/pgsql
================================================
FILE: GitHubActions/build_sqlite_fdw.sh
================================================
#!/bin/bash
################################################################################
#
# This script builds sqlite_fdw in PostgreSQL source tree.
#
# Usage: ./build_sqlite_fdw.sh pg_version mode sqlite_for_testing_dir
# pg_version is a PostgreSQL version like 17.0 to be built in.
# mode is flag for sqlite_fdw compiler.
# sqlite_for_testing_dir: path to install directory of SQLite version for testing
#
# Requirements
# - the source code of sqlite_fdw is available by git clone.
# - the source code of PostgreSQL is located in ~/workdir/postgresql-{pg_version}.
# - SQLite development package is installed in a system.
################################################################################
VERSION="$1"
MODE="$2"
mkdir -p ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw
tar zxf ./sqlite_fdw.tar.gz -C ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw/
cd ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw
# show locally compiled sqlite library
ls -la /usr/local/lib
if [ "$MODE" == "postgis" ]; then
make ENABLE_GIS=1 SQLITE_FOR_TESTING_DIR="$3"
else
make SQLITE_FOR_TESTING_DIR="$3"
fi
sudo make install
================================================
FILE: GitHubActions/detect_targets.sh
================================================
#!/bin/bash
################################################################################
#
# This script detects target PostgreSQL versions for sqlite_fdw testing from
# directory names in ./sql directory. Detected versions will be outputed to
# the standard output as an array of string like ["16.3","17.0"].
#
# Usage: ./detect_targets.sh
#
# Requirements
# - there is a directory named "sql" in a curent directory.
#
################################################################################
dirs="./sql/*"
pattern="[0-9]+\.[0-9]+"
targets="["
for pathname in $dirs; do
if [[ "$pathname" =~ $pattern ]]; then
target=`basename $pathname`
if [ "$targets" != "[" ]; then
targets+=","
fi
targets+="\"$target\""
fi
done
targets+="]"
echo "$targets"
================================================
FILE: GitHubActions/download_postgis.sh
================================================
#!/bin/bash
################################################################################
#
# This script downloads PostGIS from the official web site into ./workdir
# then builds it.
#
# Usage: ./download_postgis.sh postgis_version
# postgis_version is a PostGIS version to be installed.
#
# Requirements
# - be able to connect to the PostGIS official web site by wget.
#
################################################################################
POSTGIS_VERSION=$1
mkdir -p ./workdir
cd ./workdir
pgisfile="postgis-${POSTGIS_VERSION}.tar.gz"
if [ ! -f "$pgisfile" ]; then
wget -nv "http://download.osgeo.org/postgis/source/$pgisfile"
tar -xzf "$pgisfile"
mv postgis-${POSTGIS_VERSION} postgis -v
echo "PostGIS source code directory " $(dirname $(readlink -f postgis))
else
echo "PostGIS downloaded"
fi
================================================
FILE: GitHubActions/env.sh
================================================
#!/bin/bash
################################################################################
#
# This script configures apt.conf to set a proxy if an environment variable
# HTTP_PROXY or HTTPS_PROXY is set.
#
# Usage: ./env.sh
#
# Requirements
# - having superuser privileges
#
################################################################################
if [ -z $HTTP_PROXY ] && [ "$HTTP_PROXY" != "" ]; then
echo 'Acquire::http::proxy "$HTTP_PROXY";' | sudo tee /etc/apt/apt.conf
fi
if [ -z $HTTPS_PROXY ] && [ "$HTTPS_PROXY" != "" ]; then
echo 'Acquire::https::proxy "$HTTPS_PROXY";' | sudo tee -a /etc/apt/apt.conf
fi
================================================
FILE: GitHubActions/execute_test.sh
================================================
#!/bin/bash
################################################################################
#
# This script executes a regression test pf sqlite_fdw by calling test.sh in
# sqlite_fdw. If all tests are passed, this script will exit successfully.
# Otherwise, it will exit with failure.
# Usage: ./execute_test.sh pg_version mode sqlite_for_testing_dir
# pg_version is a PostgreSQL version to be tested like 17.0.
# mode is flag for sqlite_fdw compiler.
# sqlite_for_testing_dir: path to install directory of SQLite version for testing
#
# Requiremets
# - the source code of PostgreSQL is located in ./workdir/postgresql-{pg_version}.
# - the source code of sqlite_fdw is loacted in ./workdir/postgresql-{pg_version}/contrib/sqlite_fdw.
# - PostgreSQL and sqlite_fdw were built.
# - this script assumes that tests are passed if this file (created by executing
# the test) contains " ALL {number} tests passed" at the last or the 3rd line
# from the end.
#
################################################################################
VERSION=$1
MODE="$2"
SQLITE_FOR_TESTING_DIR="$3"
cd ./workdir/postgresql-${VERSION}/contrib/sqlite_fdw
if [ "$MODE" == "postgis" ]; then
export ENABLE_GIS=1
# Start postgres server
POSTGRES_HOME=/usr/local/pgsql
${POSTGRES_HOME}/bin/initdb ${POSTGRES_HOME}/databases
${POSTGRES_HOME}/bin/pg_ctl -D ${POSTGRES_HOME}/databases -l logfile start
# Change the testing method
sed -i 's/make check/make installcheck/' test.sh
fi
# Execute test script
chmod +x ./test.sh
./test.sh $MAKEFILE_OPT
last_line=$(tail -n 1 make_check.out)
third_line_from_the_last=$(tail -n 3 make_check.out | head -n 1)
pattern=" All [0-9]+ tests passed.+"
if [[ "$last_line" =~ $pattern ]]; then
echo "last_line"
elif [[ "$third_line_from_the_last" =~ $pattern ]]; then
echo "$third_line_from_the_last"
else
echo "Error : not All the tests passed"
echo "last line : '$last_line'"
echo "thierd_line_from_the_last : '$third_line_from_the_last'"
exit 1
fi
================================================
FILE: GitHubActions/install_locales.sh
================================================
#!/bin/bash
################################################################################
#
# This script installs some locales and language packs used by sqlite_fdw
# tests in Ubuntu.
#
# Usage: ./install_locales.sh
#
# Requirements:
# - having superuser privileges
#
################################################################################
sudo apt-get update
sudo apt-get install locales language-pack-ja
sudo locale-gen ja_JP.EUC-JP
sudo apt-get install language-pack-ko-base language-pack-ko
sudo locale-gen ko_KR.EUC-KR
sudo apt-get install language-pack-bg-base language-pack-bg
sudo locale-gen bg_BG
sudo apt-get install libreadline8 libreadline-dev
================================================
FILE: GitHubActions/install_sqlite.sh
================================================
#!/bin/bash
################################################################################
#
# This sript downloads SQLite source code from the official web site into
# ./workdir then builds and installs it.
#
# Usage: ./install_sqlite.sh version year testing_mode sqlite_for_testing_dir [configure_options]
# version: SQLite version to be installed.
# year: A year of SQLite released. It is used for determining a download URL.
# testing_mode: 'default' or 'postgis' value.
# sqlite_for_testing_dir: path to install directory of the specified SQLite version
# configure_options: are a list of option for sqlite server.
#
# Ex) ./install_sqlite.sh 3420000 2023 postgis /opt/sqlite_for_testing --enable-rtree
#
# Requirements
# - be able to connect to the SQLite official web site by curl.
# - having superuser privileges
#
################################################################################
VERSION="$1"
YEAR="$2"
TESTING_MODE="$3"
SQLITE_FOR_TESTING_DIR="$4"
CONFIGURE_OPTIONS=""
while (( "$#" )); do
CONFIGURE_OPTIONS="$CONFIGURE_OPTIONS $5"
shift
done
echo "SQLite ver $VERSION ($YEAR), mode $TESTING_MODE, install to $SQLITE_FOR_TESTING_DIR with options $CONFIGURE_OPTIONS";
mkdir -p ./workdir
cd ./workdir
vsrc="sqlite-src-${VERSION}"
adr="https://www.sqlite.org/${YEAR}/$vsrc.zip"
echo "SQLite source code archive: $adr"
wget "$adr" -O "$vsrc.zip"
unzip "$vsrc.zip" > /dev/null
cd "$vsrc"
export CFLAGS=-DSQLITE_ENABLE_COLUMN_METADATA
confcom="./configure --enable-fts5 --prefix=$SQLITE_FOR_TESTING_DIR"
if [ ! -z "$CONFIGURE_OPTIONS" ]; then
confcom+="$CONFIGURE_OPTIONS"
fi
echo "SQLite configure call: $confcom"
$confcom
make
echo "----- SQLITE INSTALL directory $SQLITE_FOR_TESTING_DIR -----"
sudo make install
if [ "$TESTING_MODE" == "postgis" ]; then
sudo apt-get install libspatialite-dev -y
fi
================================================
FILE: License
================================================
SQLite Foreign Data Wrapper for PostgreSQL
Copyright (c) 2018, TOSHIBA CORPORATION
Copyright (c) 2011 - 2016, EnterpriseDB Corporation
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose, without fee, and without a written agreement is
hereby granted, provided that the above copyright notice and this paragraph and
the following two paragraphs appear in all copies.
IN NO EVENT SHALL TOSHIBA CORPORATION BE LIABLE TO ANY PARTY FOR
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST
PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF
TOSHIBA CORPORATION HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
TOSHIBA CORPORATION SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND
TOSHIBA CORPORATION HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT,
UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
================================================
FILE: META.json
================================================
{
"name": "sqlite_fdw",
"abstract": "Foreign Data Wrapper for SQLite databases",
"description": "PostgreSQL extension which implements a Foreign Data Wrapper (FDW) for SQLite databases.",
"version": "2.5.0",
"maintainer": "pgspider",
"license": "postgresql",
"provides": {
"sqlite_fdw": {
"abstract": "Foreign Data Wrapper for SQLite databases",
"file": "sqlite_fdw.c",
"docfile": "README.md",
"version": "2.5.0"
}
},
"prereqs": {
"runtime": {
"requires": {
"PostgreSQL": "9.6.0"
}
}
},
"resources": {
"bugtracker": {
"web": "http://github.com/pgspider/sqlite_fdw/issues/"
},
"repository": {
"url": "git://github.com/pgspider/sqlite_fdw.git",
"web": "https://github.com/pgspider/sqlite_fdw/",
"type": "git"
}
},
"generated_by": "David E. Wheeler",
"meta-spec": {
"version": "1.0.0",
"url": "http://pgxn.org/meta/spec.txt"
},
"tags": [
"sqlite",
"fdw",
"foreign data wrapper",
"sqlite_fdw"
]
}
================================================
FILE: Makefile
================================================
######################################################################-------------------------------------------------------------------------
#
# SQLite Foreign Data Wrapper for PostgreSQL
#
# Portions Copyright (c) 2018, TOSHIBA CORPORATION
#
# IDENTIFICATION
# Makefile
#
##########################################################################
MODULE_big = sqlite_fdw
OBJS = connection.o option.o deparse.o sqlite_query.o sqlite_fdw.o sqlite_data_norm.o sqlite_gis.o
EXTENSION = sqlite_fdw
DATA = sqlite_fdw--1.0.sql sqlite_fdw--1.0--1.1.sql
ifdef ENABLE_GIS
PG_CFLAGS += -DSQLITE_FDW_GIS_ENABLE
GIS_DEP_TESTS_DIR = with_gis_support
GIS_TEST = postgis
$(info There is PostGIS support for SQLite FDW)
else
GIS_DEP_TESTS_DIR = without_gis_support
GIS_TEST = nogis
$(info There is NO PostGIS support for SQLite FDW)
endif
# Tests for PostgreSQL data types support
DATA_TYPE_TESTS = types/bitstring types/bool types/float4 types/float8 types/int4 types/int8 types/json types/numeric types/macaddr types/macaddr8 types/out_of_range types/timestamp types/uuid
# Tests with different versions with GIS support and without GIS support
GIS_DEP_TESTS = $(GIS_DEP_TESTS_DIR)/type $(GIS_DEP_TESTS_DIR)/auto_import $(GIS_DEP_TESTS_DIR)/$(GIS_TEST)
ifndef REGRESS
# System tests, full default sequence
REGRESS = libsqlite extra/sqlite_fdw_post $(DATA_TYPE_TESTS) extra/join extra/limit extra/aggregates extra/prepare extra/select_having extra/select extra/insert extra/update extra/encodings sqlite_fdw aggregate selectfunc $(GIS_DEP_TESTS)
endif
# Other encodings also are tested. Client encoding should be UTF-8.
REGRESS_OPTS = --encoding=utf8
UNAME = uname
OS := $(shell $(UNAME))
ifeq ($(OS), Darwin)
DLSUFFIX = .dylib
else
DLSUFFIX = .so
endif
ifdef SQLITE_FOR_TESTING_DIR
SHLIB_LINK := -L$(SQLITE_FOR_TESTING_DIR)/lib -lsqlite3
PG_CFLAGS += -I$(SQLITE_FOR_TESTING_DIR)/include -Wl,-rpath,$(SQLITE_FOR_TESTING_DIR)/lib
else
SHLIB_LINK := -lsqlite3
endif
ifdef ENABLE_GIS
override SHLIB_LINK += -lspatialite
endif
ifdef USE_PGXS
PG_CONFIG = pg_config
PGXS := $(shell $(PG_CONFIG) --pgxs)
include $(PGXS)
ifndef MAJORVERSION
MAJORVERSION := $(basename $(VERSION))
endif
ifeq (,$(findstring $(MAJORVERSION), 13 14 15 16 17))
$(error PostgreSQL 13, 14, 15, 16 or 17 is required to compile this extension)
endif
else
subdir = contrib/sqlite_fdw
top_builddir = ../..
include $(top_builddir)/src/Makefile.global
include $(top_srcdir)/contrib/contrib-global.mk
endif
ifdef REGRESS_PREFIX
REGRESS_PREFIX_SUB = $(REGRESS_PREFIX)
else
REGRESS_PREFIX_SUB = $(VERSION)
endif
REGRESS := $(addprefix $(REGRESS_PREFIX_SUB)/,$(REGRESS))
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/extra)
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/types)
$(shell mkdir -p results/$(REGRESS_PREFIX_SUB)/$(GIS_DEP_TESTS_DIR))
# $(info ENABLE_GIS is $(ENABLE_GIS))
# $(info SHLIB_LINK is $(SHLIB_LINK))
# $(info LD_LIBRARY_PATH is $(LD_LIBRARY_PATH))
# $(info PG_CFLAGS is $(PG_CFLAGS))
# $(info PG_CPPFLAGS is $(PG_CPPFLAGS))
# $(info REGRESS is $(REGRESS))
# $(info DLSUFFIX is $(DLSUFFIX))
ifdef ENABLE_GIS
check: temp-install
temp-install: EXTRA_INSTALL+=contrib/postgis
checkprep: EXTRA_INSTALL+=contrib/postgis
endif
================================================
FILE: README.md
================================================
SQLite Foreign Data Wrapper for PostgreSQL
==========================================
This is a foreign data wrapper (FDW) to connect [PostgreSQL](https://www.postgresql.org/)
to [SQLite](https://sqlite.org/) database file. This FDW works with PostgreSQL 13, 14, 15, 16, 17 and confirmed with SQLite 3.49.0.
<img src="https://upload.wikimedia.org/wikipedia/commons/2/29/Postgresql_elephant.svg" align="center" height="100" alt="PostgreSQL"/> + <img src="SQLite.png" align="center" height="100" alt="SQLite"/>
Also this foreign data wrapper (FDW) can connect PostgreSQL with [PostGIS](https://www.postgis.net/)
to [SpatiaLite](https://www.gaia-gis.it/fossil/libspatialite/index) SQLite database file. This FDW works with PostGIS 2+ and confirmed with SpatiaLite 5.1. See [GIS support description](GIS.md).
<img src="https://www.tmapy.cz/wp-content/uploads/2021/02/postgis-logo.png" align="center" height="80" alt="PostGIS"/> + <img src="https://www.gaia-gis.it/fossil/libspatialite/logo" align="center" height="80" alt="SpatiaLite"/>
Contents
--------
1. [Features](#features)
2. [Supported platforms](#supported-platforms)
3. [Installation](#installation)
4. [Usage](#usage)
5. [Functions](#functions)
6. [Identifier case handling](#identifier-case-handling)
7. [Generated columns](#generated-columns)
8. [Character set handling](#character-set-handling)
9. [Examples](#examples)
10. [Limitations](#limitations)
11. [Tests](#tests)
12. [Contributing](#contributing)
13. [Useful links](#useful-links)
Features
--------
### Common features
- Transactions
- Support `INSERT`/`UPDATE`/`DELETE` (both Direct modification and Foreign modification), see [access control](#connection-to-sqlite-database-file-and-access-control) about conditions of succesfully data modification.
- Support `TRUNCATE` by deparsing into `DELETE` statement without `WHERE` clause.
- Allow control over whether foreign servers keep connections open after transaction completion. This is controlled by `keep_connections` and defaults to on.
- Support list cached connections to foreign servers by using function `sqlite_fdw_get_connections()`
- Support discard cached connections to foreign servers by using function `sqlite_fdw_disconnect()`, `sqlite_fdw_disconnect_all()`.
- Support Bulk `INSERT` by using `batch_size` option
- Support `INSERT`/`UPDATE` with generated column
- Support `ON CONFLICT DO NOTHING`
- Support mixed SQLite [data affinity](https://www.sqlite.org/datatype3.html) input and filtering (`SELECT`/`WHERE` usage) for such data types as
- `timestamp`: `text` and `int`,
- `uuid`: `text`(32..39) and `blob`(16),
- `bool`: `text`(1..5) and `int`,
- `double precision`, `float` and `numeric`: `real` values and special values with `text` affinity (`+Infinity`, `-Infinity`, `NaN`),
- `macaddr`: `text`(12..17) or `blob`(6) or `integer`,
- `macaddr8`: `text`(16..23) or `blob`(8) or `integer`,
- `json`: `text`(default) or `blob` as SQLite `jsonb` object.
- Support mixed SQLite [data affinity](https://www.sqlite.org/datatype3.html) output (`INSERT`/`UPDATE`) for such data types as
- `timestamp`: `text`(default) or `int`,
- `uuid`: `text`(36) or `blob`(16)(default),
- `macaddr`: `text`(17) or `blob`(6) or `integer`(default),
- `macaddr8`: `text`(23) or `blob`(8) or `integer`(default).
- Full support for `+Infinity` (means ∞) and `-Infinity` (means -∞) special values for IEEE 754-2008 numbers in `double precision`, `float` and `numeric` columns including such conditions as ` n < '+Infinity'` or ` m > '-Infinity'`.
- Bidirectional data transformation for `geometry` and `geography` data types for SpatiaLite ↔ PostGIS. [EWKB](https://libgeos.org/specifications/wkb/#extended-wkb) data transport is used. See [GIS support description](GIS.md).
### Pushing down
- `WHERE` clauses are pushdowned
- Aggregate function are pushdowned
- `ORDER BY` is pushdowned
- Joins (left/right/inner/cross/semi) are pushdowned
- `CASE` expressions are pushdowned.
- `LIMIT` and `OFFSET` are pushdowned when all tables in the query are foreign tables belongs to the same PostgreSQL `FOREIGN SERVER` object.
- Support `GROUP BY`, `HAVING` push-down.
- `mod()` is pushdowned. In PostgreSQL this function gives [argument-dependend data type](https://www.postgresql.org/docs/current/functions-math.html), but result from SQLite always [have `real` affinity](https://www.sqlite.org/lang_mathfunc.html#mod).
- `=` operator for GIS data objects is pushed down.
- Operators `->` and `->>` for `json` and `jsonb` are pushed down in `WHERE` clause.
- `upper`, `lower` and other character case functions are **not** pushed down because they does not work with UNICODE character in SQLite.
- `WITH TIES` option is **not** pushed down.
- Bit string `#` (XOR) operator is **not** pushed down because there is no equal SQLite operator.
- Operations with `macaddr` or `macaddr8` data are **not** pushed down.
- GIS data oparators are **not** pushdowned except for `=`.
### Notes about pushing down
- For push-down case, the number after floating point may be different from the result of PostgreSQL.
### Notes about features
- SQLite evaluates division by zero as `NULL`. It is different from PostgreSQL, which will display `Division by zero` error.
- The data type of column of foreign table should match with data type of column in SQLite to avoid wrong result. For example, if the column of SQLite is `float` (which will be stored as `float8`), the column of foreign table should be `float8`, too. If the column of foreign table is `float4`, it may cause wrong result when `SELECT`.
- For `key` option, user needs to specify the primary key column of SQLite table corresponding with the `key` option. If not, wrong result may occur when `UPDATE` or `DELETE`.
- When `sum` function result value is out of range, `sqlite_fdw` will display `Infinity` value. It is different from PostgreSQL, which gives `ERROR: value out of range: overflow` error.
- For `numeric` data type, `sqlite_fdw` use `sqlite3_column_double` to get value, while SQLite shell uses `sqlite3_column_text` to get value. Those 2 APIs may return different numeric value. Therefore, for `numeric` data type, the value returned from `sqlite_fdw` may different from the value returned from SQLite shell.
- `sqlite_fdw` can return implementation-dependent order for column if the column is not specified in `ORDER BY` clause.
- When the column type is `varchar array`, if the string is shorter than the declared length, values of type character will be space-padded; values of type `character varying` will simply store the shorter string.
- [String literals for `boolean`](https://www.postgresql.org/docs/current/datatype-boolean.html) (`t`, `f`, `y`, `n`, `yes`, `no`, `on`, `off` etc. case insensitive) can be readed and filtred but cannot writed, because SQLite documentation recommends only `int` affinity values (`0` or `1`) for boolean data and usually text boolean data belongs to legacy datasets.
- Directry for SQLite foreign table you can use SQLite specific extractor operand for `->` or `->>` like `$.a.d[1]` in `WHERE` clause, but PostgreSQL will calculate result of equal expression in `SELECT` clause as `NULL`.
- If you will use unsupported by `sqlite_fdw` older SQLite versions from your OS, please note SQLite JSON processnig behaviour was unstable between 3.45.0 and 3.48.0 especially for negative array indexes. Please note this for explaining any unexpected results after `->` or `->>` operators or failed tests on your OS.
Also see [Limitations](#limitations)
Supported platforms
-------------------
`sqlite_fdw` was developed on Linux and should run on any
reasonably POSIX-compliant system.
Installation
------------
### Package installation
For some Linux distributives internal packages with `sqlite_fdw` are avalilable.
- [sqlite_fdw_14 rpm](https://pkgs.org/download/sqlite_fdw_14(x86-64)) for CentOS 9, RHEL 9, Rocky Linux 9, AlmaLinux 9. Also there is other versions.
- [sqlite_fdw git package](https://aur.archlinux.org/packages/sqlite_fdw) for Arch Linux.
### Source installation
Prerequisites:
* `gcc`
* `make`
* `postgresql-server-dev`, especially `postgres.h`
* `libsqlite3-dev`, especially `sqlite.h`
* `libspatialite-dev` only for `geometry` and `geography` data types support (SpatiaLite ↔ PostGIS) or for full tests
#### 1. Install SQLite & Postgres Development Libraries
For Debian or Ubuntu:
`apt-get install libsqlite3-dev`
`apt-get install postgresql-server-dev-XX`, where XX matches your postgres version, i.e. `apt-get install postgresql-server-dev-15`
`apt-get install libspatialite-dev` - for SpatiaLite ↔ PostGIS transformations
Instead of system `libsqlite3-dev` from OS repository you can also [download SQLite source code][1] and [build separate SQLite version][2] with FTS5 for full-text search. The directory of this not OS SQLite library can be pointed as prefix in a command like `./configure --enable-fts5 --prefix=$SQLITE_FOR_TESTING_DIR` before `make` and `make install`.
#### 2. Build and install sqlite_fdw
`sqlite_fdw` does not require to be compiled with PostGIS and `libspatialite-dev`. They are used only for full tests which includes test for GIS support.
Before building please add a directory of `pg_config` to PATH or ensure `pg_config` program is accessible from command line only by the name.
Build and install without GIS support
```sh
make USE_PGXS=1
make install USE_PGXS=1
```
Build and install without GIS support against separate compiled and installed SQLite version placed at given path.
Example for `/opt/testing/other/SQLite/3.49.0`.
```sh
make USE_PGXS=1 SQLITE_FOR_TESTING_DIR=/opt/testing/other/SQLite/3.49.0
make install USE_PGXS=1 SQLITE_FOR_TESTING_DIR=/opt/testing/other/SQLite/3.49.0
```
Build and install with GIS support
```sh
make USE_PGXS=1 ENABLE_GIS=1
make install USE_PGXS=1 ENABLE_GIS=1
```
Also you can build against separate SQLite version and with GIS support using obvious combination of variables.
If you want to build `sqlite_fdw` in a source tree of PostgreSQL, use
```sh
make
make install
```
You also can add `ENABLE_GIS=1` for GIS support or for testing if you have got
compiled PostGIS in `contrib/postgis` directory. Please refer [PostGIS installation script](GitHubActions/build_postgis.sh) for Debian/Ubuntu configuration details.
Usage
-----
### CREATE SERVER options
`sqlite_fdw` accepts the following options via the `CREATE SERVER` command:
- **database** as *string*, **required**, no default
SQLite database file address.
- **updatable** as *boolean*, optional, default *true*
This option can allow or disallow data modification on foreign server for all foreign objects by default. Please note, this option can be overwritten on table level or have no effect because of some filesystem restrictions, see [connection to SQLite database file and access control](#connection-to-sqlite-database-file-and-access-control). This is only recommentadion of PostgreSQL foreign server owner user not to modify data in foreign server tables. For strong restriction see the next option `force_readonly`.
- **force_readonly** as *boolean*, optional, default *false*
This option is useful if you need grant user permission to create a foreign tables on the foreign server and revoke user permission to modify any table data on this foreign server. This option with `true` value can disallow any write operations on foreign server table data through SQLite file readonly access mode. This option driven only by foreign server owner role can not be overwritten by any `updatable` option value. This is a strong restriction given by PostgreSQL foreign server owner user not to modify data in any foreign server tables. Also see [Connection to SQLite database file and access control](#connection-to-sqlite-database-file-and-access-control).
- **truncatable** as *boolean*, optional, default *false*
Allows foreign tables to be truncated using the `TRUNCATE` command.
- **keep_connections** as *boolean*, optional, default *true*
Allows to keep connections to SQLite while there is no SQL operations between PostgreSQL and SQLite.
- **batch_size** as *integer*, optional, default *1*
Specifies the number of rows which should be inserted in a single `INSERT` operation. This setting can be overridden for individual tables.
### CREATE USER MAPPING options
There is no user or password conceptions in SQLite, hence `sqlite_fdw` no need any `CREATE USER MAPPING` command. About access model and possible data modifications problems see about [connection to SQLite database file and access control](#connection-to-sqlite-database-file-and-access-control).
### CREATE FOREIGN TABLE options
`sqlite_fdw` accepts the following table-level options via the
`CREATE FOREIGN TABLE` command:
- **table** as *string*, optional, no default
SQLite table name. Use if not equal to name of foreign table in PostgreSQL. Also see about [identifier case handling](#identifier-case-handling).
- **truncatable** as *boolean*, optional, default from the same `CREATE SERVER` option
See `CREATE SERVER` options section for details.
- **batch_size** as *integer*, optional, default from the same `CREATE SERVER` option
See `CREATE SERVER` options section for details.
- **updatable** as *boolean*, optional, default *true*
This option can allow or disallow data modification on separate foreign table. Please note, this option can have no effect if there is foreign server option `force_readonly` = `true` or depends on filesystem context, see about [connection to SQLite database file and access control](#connection-to-sqlite-database-file-and-access-control).
`sqlite_fdw` accepts the following column-level options via the
`CREATE FOREIGN TABLE` command:
- **column_name** as *string*, optional, no default
This option gives the column name to use for the column on the remote server. Also see about [identifier case handling](#identifier-case-handling).
- **column_type** as *string*, optional, no default
Set preferred SQLite affinity for some PostgreSQL data types can be stored in different ways
in SQLite (mixed affinity case). Updated and inserted values will have this affinity. Default preferred SQLite affinity for `timestamp` and `uuid` PostgreSQL data types is `text`.
- Use `INT` value for SQLite column (epoch Unix Time) to be treated/visualized as `timestamp` in PostgreSQL.
- Use `BLOB` value for SQLite column to be treated/visualized as `uuid`.
- **key** as *boolean*, optional, default *false*
Indicates a column as a part of primary key or unique key of SQLite table.
### Datatypes
This table represents `sqlite_fdw` behaviour if in PostgreSQL foreign table column some [affinity](https://www.sqlite.org/datatype3.html) of SQLite data is detected. Some details about data values support see in [limitations](#limitations).
* **∅** - no support (runtime error)
* **✔** - 1↔1, PostgreSQL datatype is equal to SQLite affinity
* **✔-** - PostgreSQL datatype is equal to SQLite affinity, but possible out of range error
* **V** - transparent transformation
* **V+** - transparent transformation if possible
* **i** - ISO:SQL transformation for some special constants
* **?** - not described/not tested
* **T** - cast to text in SQLite utf-8 encoding, then to **PostgreSQL text with current encoding of database** and then transformation for `text` affinity if applicable
SQLite `NULL` affinity always can be transparent converted for a nullable column in PostgreSQL.
**SQLite data processing dependend on affinity**
| PostgreSQL | INT | REAL | BLOB | TEXT | TEXT but <br>empty|nearest<br>affinity|
|-------------:|:------------:|:------------:|:------------:|:------------:|:------------:|-------------:|
| bool | V | ∅ | T | i | ∅ | INT |
| bit(n) | V<br>(n<=64) | ∅ | ∅ | ∅ | ∅ | INT |
| bytea | ∅ | ∅ | ✔ | V | ? | BLOB |
| char(n) | ? | ? | T | ✔- | V | TEXT |
| date | V | V | T | V+ | `NULL` | ? |
| float4 | V+ | ✔ | ∅ | i | `NULL` | REAL |
| float8 | V+ | ✔ | ∅ | i | `NULL` | REAL |
|[geometry](GIS.md)| ∅ | ∅ | V+ | ∅ | ∅ | BLOB |
|[geography](GIS.md)|∅ | ∅ | V+ | ∅ | ∅ | BLOB |
| int2 | ✔- | ? | ∅ | ∅ | `NULL` | INT |
| int4 | ✔- | ? | ∅ | ∅ | `NULL` | INT |
| int8 | ✔ | ? | ∅ | ∅ | `NULL` | INT |
| json | ∅ | ∅ | V+ | V+ | ∅ | TEXT |
| jsonb | ∅ | ∅ | V+ | V+ | ∅ | BLOB |
| macaddr | ✔- | ∅ | V<br>(Len=6b)| V+ | ? | INT |
| macaddr8 | ✔ | ∅ | V<br>(Len=8b)| V+ | ? | INT |
| name | ? | ? | T | ✔- | `NULL` | TEXT |
| numeric | V | V | T | i | `NULL` | REAL |
| text | ? | ? | T | ✔ | V | TEXT |
| time | V | V | T | V+ | `NULL` | ? |
| timestamp | V | V | T | V+ | `NULL` | ? |
|timestamp + tz| V | V | T | V+ | `NULL` | ? |
| uuid | ∅ | ∅ |V+<br>(Len=16b)| V+ | ∅ | TEXT, BLOB |
| varchar(n) | ? | ? | T | ✔- | V | TEXT |
| varbit(n) | V<br>(n<=64) | ∅ | ∅ | ∅ | ∅ | INT |
### IMPORT FOREIGN SCHEMA options
`sqlite_fdw` supports [IMPORT FOREIGN SCHEMA](https://www.postgresql.org/docs/current/sql-importforeignschema.html)
(PostgreSQL 9.5+) and accepts following options via the `IMPORT FOREIGN SCHEMA` command:
- **import_default** as *boolean*, optional, default *false*
Allow borrowing default values from SQLite table DDL.
- **import_not_null** as *boolean*, optional, default *true*
Allow borrowing `NULL`/`NOT NULL` constraints from SQLite table DDL.
#### Datatype translation rules for `IMPORT FOREIGN SCHEMA`
| SQLite | PostgreSQL |
|-------------:|:----------------:|
| int | bigint |
| char | text |
| clob | text |
| text | text |
| blob | bytea |
| real | double precision |
| floa | double precision |
| doub | double precision |
| datetime | timestamp |
| time | time |
| date | date |
| uuid | uuid |
| macaddr | macaddr |
| macaddr8 | macaddr8 |
| [geometry](GIS.md) | geometry |
| [geography](GIS.md) | geography |
| json | json |
| jsonb | jsonb |
**Note:** In case of `sqlite_fdw` compiling without GIS support, GIS data
types will be converted to `bytea`.
### TRUNCATE support
`sqlite_fdw` implements the foreign data wrapper `TRUNCATE` API, available
from PostgreSQL 14.
As SQLite does not provide a `TRUNCATE` command, it is simulated with a
simple unqualified `DELETE` operation.
Actually, `TRUNCATE ... CASCADE` can be simulated if we create child table of SQLite with foreign keys and `ON DELETE CASCADE`, and then executing `TRUNCATE` (which will be deparsed to `DELETE`).
Following restrictions apply:
- `TRUNCATE ... RESTART IDENTITY` is not supported
- SQLite tables with foreign key references can cause errors during truncating
### Connection to SQLite database file and access control
In OS `sqlite_fdw` works as executed code with permissions of user of PostgreSQL server. Usually it is `postgres` OS user.
#### Data read access
For succesfully connection to SQLite database file you must have at least existed and correct SQLite file readable for OS user of PostgreSQL server process. This means all directories by path to the file must be also readable (listable) for OS user of PostgreSQL server process. There are no other conditions for PostreSQL database superuser to read all of SQLite data if there are also `sqlite_fdw` extension in the database and `FOREIGN SERVER` for SQLite database file.
#### Data change access
Data modification access in `sqlite_fdw` drived by both operating system and PostgreSQL.
OS restrictions can disallow any SQLite data modifications. Hence any PostgreSQL `FOREIGN SERVER` or `FOREIGN TABLE` options or `GRANT`s can be absolutely not effective. In this case SQLite data modification operations allowed by PostgreSQL can cause error message from SQLite like `attempt to write a readonly database` with result code `8`.
Full list of OS-leveled conditions of data modification access to SQLite database file
- Existed SQLite file is not corrupted by SQLite engine conditions.
- All path elements of the file are readable (listable) for OS user of PostgreSQL server process.
- The file and a directory of the file placed on readwrite filesystem. For example `sqashfs` is always read-only, remote `sshfs` can be read-only, a disk partition can be mounted in read-only mode etc.
- The file is writable for OS user of PostgreSQL server process.
- The directory of the file is writable for OS user of PostgreSQL server process because SQLite creates some temporary transaction files.
Full list of PostgreSQL-leveled conditions of data modification access to SQLite database file
- The `FOREIGN SERVER` of the SQLite file have no `force_readonly` = `true` option value.
- You have `USAGE` right `GRANT` for the `FOREIGN SERVER`.
- The `FOREIGN TABLE` of SQLite table have no `updatable` = `false` option value.
- If the `FOREIGN TABLE` have no `updatable` option, ensure `FOREIGN SERVER` have no `updatable` = `false` option value.
Generally for `sqlite_fdw` access management `FOREIGN SERVER` owner can be like _remote access manager_ for other FDWs.
_Remote access manager_ can block any data modififcations in remote database for _remote user_ of a FDW. In this case SQLite have no user or separate access conceptions, hence `FOREIGN SERVER` owner combines _remote access manager_ role with internal PostgreSQL roles such as `FOREIGN SERVER` access management.
Functions
---------
As well as the standard `sqlite_fdw_handler()` and `sqlite_fdw_validator()`
functions, `sqlite_fdw` provides the following user-callable utility functions:
- SETOF record **sqlite_fdw_get_connections**(server_name text, valid bool)
- bool **sqlite_fdw_disconnect**(text)
Closes connection from PostgreSQL to SQLite in the current session.
- bool **sqlite_fdw_disconnect_all()**
- **sqlite_fdw_version()**;
Returns standard "version integer" as `major version * 10000 + minor version * 100 + bugfix`.
```
sqlite_fdw_version
--------------------
20500
```
Identifier case handling
------------------------
PostgreSQL folds identifiers to lower case by default, SQLite is case insensitive by default
only for uppercase and lowercase ASCII base latin letters. It's important
to be aware of potential issues with table and column names.
Following SQL isn't correct for SQLite: `Error: duplicate column name: a`, but is correct for PostgreSQL
```sql
CREATE TABLE T (
"A" INTEGER,
"a" NUMERIC
);
```
Following SQLs is correct for both SQLite and PostgreSQL because there is no column
with names composed from ASCII base latin letters *only*.
```sql
CREATE TABLE T_кир (
"А" INTEGER,
"а" NUMERIC
);
CREATE TABLE T_ελλ (
"Α" INTEGER,
"α" NUMERIC
);
CREATE TABLE T_dia (
"Ä" INTEGER,
"ä" NUMERIC
);
```
For SQLite there is no difference between
```sql
SELECT * FROM t; -- №1
SELECT * FROM T; -- №2
SELECT * FROM "t"; -- №3
SELECT * FROM "T"; -- №4
```
For PostgreSQL the query with comment `№4` is independend query to table `T`, not to table `t` as other queries.
Please note this table name composed from ASCII base latin letters *only*. This is not applicable for other
alphabet systems or mixed names. This is because `toLower` operation in PostgreSQL is Unicode operation but
ASCII only operation in SQLite, hence other characters will not be changed.
```sql
SELECT * FROM т; -- №5
SELECT * FROM Т; -- №6
SELECT * FROM "т"; -- №7
SELECT * FROM "Т"; -- №8
```
In this case for PostgreSQL the query with comment `№8` is independend query to table `Т`, not to table `т`
as other queries. But for SQLite the queries with comments `№6` and `№8` belongs to table `Т`, and the queries with
comments `№5` and `№7` belongs to table `т`.
If there is
```sql
CREATE TABLE T (
A INTEGER,
b REAL
);
```
in SQLite, both `a` and `A` , `b` and `B` columns will have the same real datasource in SQLite in follow foreign table:
```sql
CREATE FOREIGN TABLE "SQLite test" (
"A" int4 NULL,
"B" float8 NULL,
"a" int8 NULL,
"b" numeric NULL
)
SERVER sqlite_server
OPTIONS (table 'T');
```
Generated columns
-----------------
SQLite provides support for [generated columns](https://www.sqlite.org/gencol.html).
Behaviour of `sqlite_fdw` with this columns _isn't yet described_.
Note that while `sqlite_fdw` will `INSERT` or `UPDATE` the generated column value
in SQLite, there is nothing to stop the value being modified within SQLite,
and hence no guarantee that in subsequent `SELECT` operations the column will
still contain the expected generated value. This limitation also applies to
`postgres_fdw`.
For more details on generated columns see:
- [Generated Columns](https://www.postgresql.org/docs/current/ddl-generated-columns.html)
- [CREATE FOREIGN TABLE](https://www.postgresql.org/docs/current/sql-createforeigntable.html)
Character set handling
----------------------
There is [no character set metadata](https://www.sqlite.org/search?s=d&q=character+set)
stored in SQLite, only [`PRAGMA encoding;`](https://www.sqlite.org/pragma.html#pragma_encoding) with UTF-only values (`UTF-8`, `UTF-16`, `UTF-16le`, `UTF-16be`). [SQLite text output function](https://www.sqlite.org/c3ref/column_blob.html) guarantees UTF-8 encoding.
When `sqlite_fdw` connects to a SQLite, all strings are interpreted acording the PostgreSQL database's server encoding.
It's not a problem if your PostgreSQL database encoding belongs to Unicode family. Otherewise interpretation transformation problems can occur. Some unproper for PostgreSQL database encoding characters will cause error like `character with byte sequence 0x** in encoding "UTF8" has no equivalent in encoding "**"`.
Character case functions such as `upper`, `lower` and other are not pushed down because they does not work with Unicode character in SQLite.
`Sqlite_fdw` tested with PostgreSQL database encodings `EUC_JP`, `EUC_KR`, `ISO_8859_5`, `ISO_8859_6`, `ISO_8859_7`, `ISO_8859_8`, `LATIN1`, `LATIN2`, `LATIN3`, `LATIN4`, `LATIN5`, `LATIN6`, `LATIN7`, `LATIN8`, `LATIN9`, `LATIN9`, `LATIN10`, `WIN1250`, `WIN1251`, `WIN1252`, `WIN1253`, `WIN1254`, `WIN1255`, `WIN1256`, `WIN1257` and it's synomyms. Some other encodings also can be supported, but not tested.
Examples
--------
### Install the extension:
Once for a database you need, as PostgreSQL superuser.
```sql
CREATE EXTENSION sqlite_fdw;
```
### Create a foreign server with appropriate configuration:
Once for a foreign datasource you need, as PostgreSQL superuser. Please specify SQLite database path using `database` option.
```sql
CREATE SERVER sqlite_server
FOREIGN DATA WRAPPER sqlite_fdw
OPTIONS (
database '/path/to/database'
);
```
### Grant usage on foreign server to normal user in PostgreSQL:
Once for a normal user (non-superuser) in PostgreSQL, as PostgreSQL superuser. It is a good idea to use a superuser only where really necessary, so let's allow a normal user to use the foreign server (this is not required for the example to work, but it's secirity recomedation).
```sql
GRANT USAGE ON FOREIGN SERVER sqlite_server TO pguser;
```
Where `pguser` is a sample user for works with foreign server (and foreign tables).
### User mapping
There is no user or password conceptions in SQLite, hence `sqlite_fdw` no need any `CREATE USER MAPPING` command. About access problems see in [CREATE USER MAPPING options](#create-user-mapping-options).
### Create foreign table
All `CREATE FOREIGN TABLE` SQL commands can be executed as a normal PostgreSQL user if there were correct `GRANT USAGE ON FOREIGN SERVER`. No need PostgreSQL supersuer for secirity reasons but also works with PostgreSQL supersuer.
Please specify `table` option if SQLite table name is different from foreign table name.
```sql
CREATE FOREIGN TABLE t1 (
a integer,
b text
)
SERVER sqlite_server
OPTIONS (
table 't1_sqlite'
);
```
If you want to update tables, please add `OPTIONS (key 'true')` to a primary key or unique key like the following:
```sql
CREATE FOREIGN TABLE t1(
a integer OPTIONS (key 'true'),
b text
)
SERVER sqlite_server
OPTIONS (
table 't1_sqlite'
);
```
If you need to convert INT SQLite column (epoch Unix Time) to be treated/visualized as `TIMESTAMP` in PostgreSQL, please add `OPTIONS (column_type 'INT')` when defining FOREIGN table at PostgreSQL like the following:
```sql
CREATE FOREIGN TABLE t1(
a integer,
b text,
c timestamp without time zone OPTIONS (column_type 'INT')
)
SERVER sqlite_server
OPTIONS (
table 't1_sqlite'
);
```
As above, but with aliased column names:
```sql
CREATE FOREIGN TABLE t1(
a integer,
b text OPTIONS (column_name 'test_id'),
c timestamp without time zone OPTIONS (column_type 'INT', column_name 'unixtime')
)
SERVER sqlite_server
OPTIONS (
table 't1_sqlite'
);
```
### Import a SQLite database as schema to PostgreSQL:
```sql
IMPORT FOREIGN SCHEMA someschema
FROM SERVER sqlite_server
INTO public;
```
Note: `someschema` has no particular meaning and can be set to an arbitrary value.
### Access foreign table
For the table from previous examples
```sql
SELECT * FROM t1;
```
Limitations
-----------
### SQL commands
- `COPY` command for foreign tables is not supported
- `IMPORT` of generated column is not supported
- `INSERT` into a partitioned table which has foreign partitions is not supported. Error `Not support partition insert` will display.
- `TRUNCATE` in `sqlite_fdw` always delete data of both parent and child tables (no matter user inputs `TRUNCATE table CASCADE` or `TRUNCATE table RESTRICT`) if there are foreign-keys references with `ON DELETE CASCADE` clause.
- `RETURNING` is not supported.
### Mixed affinity support
SQLite `text` affinity values which is different for SQLite unique checks can be equal for PostgreSQL because `sqlite_fdw` unifyes semantics of values, not storage form. For example `1`(integer), `Y`(text) and `tRuE`(text) SQLite values is different in SQLite but equal in PostgreSQL as `true` values of `boolean` column. This is also applicable for a data with `text` affinity in `uuid`, `timestamp`, `double precision`, `float` and `numeric` columns of foreign tables. **Please be carefully if you want to use mixed affinity column as PostgreSQL foreign table primary key**.
### Arrays
Array support is experimental. Please be careful.
- `sqlite_fdw` only supports `ARRAY` const, for example, `ANY (ARRAY[1, 2, 3])` or `ANY ('{1, 2 ,3}')`.
- `sqlite_fdw` does not support `ARRAY` expression, for example, `ANY (ARRAY[c1, 1, c1+0])`.
- For `ANY(ARRAY)` clause, `sqlite_fdw` deparses it using `IN` operator.
### Numbers (range and precision)
- For `sum` function of SQLite, output of `sum(bigint)` is `integer` value. If input values are big, the overflow error may occurs on SQLite because it overflow within the range of signed 64bit. For PostgreSQL, it can calculate as over the precision of `bigint`, so overflow does not occur.
- SQLite promises to preserve the 15 most significant digits of a floating point value. The big value which exceed 15 most significant digits may become different value after inserted.
- SQLite does not support `numeric` type as PostgreSQL. Therefore, it does not allow to store numbers with too high precision and scale. Error out of range occurs.
- SQLite does not support `NaN` special value for IEEE 754-2008 numbers. Please use this special value very cerefully because there is no such conception in SQLite at all and `NaN` value treated in SQLite as `NULL`.
- SQLite support `+Infinity` and `-Infinity` special values for IEEE 754-2008 numbers in SQL expressions with numeric context. This values can be readed with both `text` and `real` affiniy, but can be writed to SQLite only with `real` affinity (as signed out of range value `9.0e999`).
### Boolean values
- `sqlite_fdw` boolean values support exists only for `bool` columns in foreign table. SQLite documentation recommends to store boolean as value with `integer` [affinity](https://www.sqlite.org/datatype3.html). `NULL` isn't converted, 1 converted to `true`, all other `NOT NULL` values converted to `false`. During `SELECT ... WHERE condition_column` condition converted only to `condition_column`.
- `sqlite_fdw` don't provides limited support of boolean values if `bool` column in foreign table mapped to SQLite `text` [affinity](https://www.sqlite.org/datatype3.html).
### UUID values
- `sqlite_fdw` UUID values support exists only for `uuid` columns in foreign table. SQLite documentation recommends to store UUID as value with both `blob` and `text` [affinity](https://www.sqlite.org/datatype3.html). `sqlite_fdw` can pushdown both reading and filtering both `text` and `blob` values.
- Expected affinity of UUID value in SQLite table determined by `column_type` option of the column
for `INSERT` and `UPDATE` commands. PostgreSQL supports both `blob` and `text` [affinity](https://www.sqlite.org/datatype3.html).
### bit and varbit support
- `sqlite_fdw` PostgreSQL `bit`/`varbit` values support based on `int` SQLite data affinity, because there is no per bit operations for SQLite `blob` affinity data. Maximum SQLite `int` affinity value is 8 bytes length, hence maximum `bit`/`varbit` values length is 64 bits.
- `sqlite_fdw` doesn't pushdown `#` (XOR) operator because there is no equal SQLite operator.
### MAC address support
- `sqlite_fdw` PostgreSQL `macaddr`/`macaddr8` values support based on `int` SQLite data affinity, because there is no per bit operations for SQLite `blob` affinity data. For `macaddr` out of range error is possible because this type is 6 bytes length, but SQLite `int` can store value up to 8 bytes.
- `sqlite_fdw` doesn't pushdown any operations with MAC adresses because there is 3 possible affinities for it in SQLite: `integer`, `blob` and `text`.
### JSON support and operators
- Operators `->` and `->>` for `json` and `jsonb` are pushed down. This means if you deal with a foreign table only, you can use SQLite syntax of `->` and `->>` operators which is more rich than PostgreSQL syntax. In PostgreSQL this operators means only 1-leveled extraction after one call, but possible multilevel extraction in one call of the operator in SQLite. You can extract `'{"a": 2, "c": [4, 5, {"f": 7}]}' ->'c' -> 2` with result `{"f":7}` both for PostgreSQL and SQLite tables, but `'{"a": 2, "c": [4, 5, {"f": 7}]}' ->'$.c[2]'` possible only in SQLite and for a foreign table.
- For PostgreSQL numeric argument of `->` and `->>` operators means only coordinate inside of array. In SQLite transformable to number text argument of this operators also can extract array element. PostgreSQL differs `json -> (2::text)` and `json -> 2`, but SQLite not: `json -> '2'`.
- Please note you can turn off processing of normalizing possible SQLite `json` values with `text` affinity for a column with formal SQLite `json` data type as option `column_type` = `text`. This can increase `SELECT` or `ORDER` speed, because there will be no normalize function wrapping, but in this case any query will have unsuccessfully result in case of any value with `blob` affiniy including any possible SQLite `jsonb` value.
```sql
-- a query with normalization - standard ISO:SQL behaviour
EXPLAIN (VERBOSE, COSTS OFF)
SELECT "i", "j", j."j"->'c' res FROM "type_JSON" j;
QUERY PLAN
-------------------------------------------------------------
Foreign Scan on public."type_JSON" j
Output: i, j, (j -> 'c'::text)
SQLite query: SELECT `i`, json(`j`) FROM main."type_JSON"
(3 rows)
-- turn off normalization
ALTER FOREIGN TABLE "type_JSON" ALTER COLUMN j OPTIONS (ADD column_type 'text');
EXPLAIN (VERBOSE, COSTS OFF)
SELECT "i", "j", j."j"->'c' res FROM "type_JSON" j;
QUERY PLAN
-------------------------------------------------------
Foreign Scan on public."type_JSON" j
Output: i, j, (j -> 'c'::text)
SQLite query: SELECT `i`, `j` FROM main."type_JSON"
(3 rows)
```
Tests
-----
Test directory have structure as following:
```
+---sql
| +---13.15
| | filename1.sql
| | filename2.sql
| |
| +---14.12
| | filename1.sql
| | filename2.sql
| |
.................
| \---17.0
| filename1.sql
| filename2.sql
|
\---expected
| +---13.15
| | filename1.out
| | filename2.out
| |
| +---14.12
| | filename1.out
| | filename2.out
| |
.................
| \---17.0
filename1.out
filename2.out
```
The test cases for each version are based on the test of corresponding version of PostgreSQL.
You can execute test by test.sh directly.
The version of PostgreSQL is detected automatically by $(VERSION) variable in Makefile.
The corresponding sql and expected directory will be used to compare the result. For example, for Postgres 15.0, you can execute "test.sh" directly, and the sql/15.0 and expected/15.0 will be used to compare automatically.
Please don't forget a command like `export SQLITE_FOR_TESTING_DIR=` with the same path as in SQLite's `./configure --prefix` berfore testing if you want to test not against your OS SQLite version, but against separate downloaded, compiled and installed SQLite version.
Test data directory is `/tmp/sqlite_fdw_test`. If you have `/tmp` mounted as `tmpfs` the tests will be up to 800% faster.
Contributing
------------
Opening issues and pull requests on GitHub are welcome.
For pull request, please make sure these items below for testing:
- Create test cases (if needed) for the latest version of PostgreSQL supported by `sqlite_fdw`. All error testcases should have a comment about test purpose.
- Execute test cases and update expectations for the latest version of PostgreSQL
- Test creation and execution for other PostgreSQL versions are welcome but not required.
Preferred code style see in PostgreSQL source codes. For example
```C
type
funct_name (type arg ...)
{
t1 var1 = value1;
t2 var2 = value2;
for (;;)
{
}
if ()
{
}
}
```
Useful links
------------
### Source
- https://github.com/pgspider/sqlite_fdw
- https://pgxn.org/dist/sqlite_fdw/
### General FDW Documentation
- https://www.postgresql.org/docs/current/ddl-foreign-data.html
- https://www.postgresql.org/docs/current/sql-createforeigndatawrapper.html
- https://www.postgresql.org/docs/current/sql-createforeigntable.html
- https://www.postgresql.org/docs/current/sql-importforeignschema.html
- https://www.postgresql.org/docs/current/fdwhandler.html
- https://www.postgresql.org/docs/current/postgres-fdw.html
### Other FDWs
- https://wiki.postgresql.org/wiki/Fdw
- https://pgxn.org/tag/fdw/
License
-------
* Copyright © 2018, TOSHIBA CORPORATION
* Copyright © 2011 - 2016, EnterpriseDB Corporation
Permission to use, copy, modify, and distribute this software and its documentation for any purpose, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and this paragraph and the following two paragraphs appear in all copies.
See the [`License`][3] file for full details.
[1]: https://www.sqlite.org/download.html
[2]: https://www.sqlite.org/howtocompile.html
[3]: License
================================================
FILE: connection.c
================================================
/*-------------------------------------------------------------------------
*
* SQLite Foreign Data Wrapper for PostgreSQL
*
* Portions Copyright (c) 2018, TOSHIBA CORPORATION
*
* IDENTIFICATION
* connection.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "sqlite_fdw.h"
#include "access/xact.h"
#include "commands/defrem.h"
#if (PG_VERSION_NUM >= 140000 && PG_VERSION_NUM < 150000)
#include "miscadmin.h"
#endif
#include "optimizer/cost.h"
#include "utils/builtins.h"
#include "utils/inval.h"
#include "utils/syscache.h"
/*
* Connection cache hash table entry
*
* The lookup key in this hash table is the foreign server OID
*/
typedef Oid ConnCacheKey;
typedef struct ConnCacheEntry
{
ConnCacheKey key; /* hash key (must be first) */
sqlite3 *conn; /* connection to foreign server, or NULL */
/* Remaining fields are invalid when conn is NULL: */
int xact_depth; /* 0 = no xact open, 1 = main xact open, 2 =
* one level of subxact open, etc */
bool keep_connections; /* setting value of keep_connections
* server option */
bool truncatable; /* check table can truncate or not */
bool readonly; /* option force_readonly, readonly SQLite file mode */
bool invalidated; /* true if reconnect is pending */
Oid serverid; /* foreign server OID used to get server name */
List *stmtList; /* list stmt associated with conn */
uint32 server_hashvalue; /* hash value of foreign server OID */
} ConnCacheEntry;
/*
* Connection cache (initialized on first use)
*/
static HTAB *ConnectionHash = NULL;
/* tracks whether any work is needed in callback functions */
static volatile bool xact_got_connection = false;
PG_FUNCTION_INFO_V1(sqlite_fdw_get_connections);
PG_FUNCTION_INFO_V1(sqlite_fdw_disconnect);
PG_FUNCTION_INFO_V1(sqlite_fdw_disconnect_all);
static sqlite3 *sqlite_open_db(const char *dbpath, int flags);
static void sqlite_make_new_connection(ConnCacheEntry *entry, ForeignServer *server);
void sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level, List **busy_connection);
static void sqlite_begin_remote_xact(ConnCacheEntry *entry);
static void sqlitefdw_xact_callback(XactEvent event, void *arg);
static void sqlitefdw_reset_xact_state(ConnCacheEntry *entry, bool toplevel);
static void sqlitefdw_subxact_callback(SubXactEvent event,
SubTransactionId mySubid,
SubTransactionId parentSubid,
void *arg);
static void sqlitefdw_inval_callback(Datum arg, int cacheid, uint32 hashvalue);
static void sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel, List **busy_connection);
#if PG_VERSION_NUM >= 140000
static bool sqlite_disconnect_cached_connections(Oid serverid);
#endif
static void sqlite_finalize_list_stmt(List **list);
static List *sqlite_append_stmt_to_list(List *list, sqlite3_stmt * stmt);
typedef struct BusyHandlerArg
{
sqlite3 *conn;
const char *sql;
int level;
} BusyHandlerArg;
/*
* sqlite_get_connection:
* Get a connection which can be used to execute queries on
* the remote Sqlite server with the user's authorization. A new connection
* is established if we don't already have a suitable one.
*/
sqlite3 *
sqlite_get_connection(ForeignServer *server, bool truncatable)
{
bool found;
ConnCacheEntry *entry;
ConnCacheKey key;
/* First time through, initialize connection cache hashtable */
if (ConnectionHash == NULL)
{
HASHCTL ctl;
MemSet(&ctl, 0, sizeof(ctl));
ctl.keysize = sizeof(ConnCacheKey);
ctl.entrysize = sizeof(ConnCacheEntry);
/* allocate ConnectionHash in the cache context */
ctl.hcxt = CacheMemoryContext;
ConnectionHash = hash_create("sqlite_fdw connections", 8,
&ctl,
#if (PG_VERSION_NUM >= 140000)
HASH_ELEM | HASH_BLOBS);
#else
HASH_ELEM | HASH_BLOBS | HASH_CONTEXT);
#endif
/*
* Register some callback functions that manage connection cleanup.
* This should be done just once in each backend.
*/
RegisterXactCallback(sqlitefdw_xact_callback, NULL);
RegisterSubXactCallback(sqlitefdw_subxact_callback, NULL);
CacheRegisterSyscacheCallback(FOREIGNSERVEROID,
sqlitefdw_inval_callback, (Datum) 0);
}
/* Set flag that we did GetConnection during the current transaction */
xact_got_connection = true;
key = server->serverid;
/*
* Find or create cached entry for requested connection.
*/
entry = hash_search(ConnectionHash, &key, HASH_ENTER, &found);
if (!found)
{
/* If can not find any cached entry => initialize new hashtable entry */
entry->conn = NULL;
}
/*
* If the connection needs to be remade due to invalidation, disconnect as
* soon as we're out of all transactions.
*/
if (entry->conn != NULL && entry->invalidated && entry->xact_depth == 0)
{
int rc = sqlite3_close(entry->conn);
elog(DEBUG1, "closing connection %p for option changes to take effect. sqlite3_close=%d",
entry->conn, rc);
entry->conn = NULL;
}
/*
* If cache entry doesn't have a connection, we have to establish a new
* connection. (If sqlite_open_db has an error, the cache entry will
* remain in a valid empty state, ie conn == NULL.)
*/
if (entry->conn == NULL)
sqlite_make_new_connection(entry, server);
entry->truncatable = truncatable;
/*
* SQLite FDW support TRUNCATE command by executing DELETE statement
* without WHERE clause. In order to delete records in parent and child
* table subsequently, SQLite FDW executes "PRAGMA foreign_keys = ON"
* before executing DELETE statement. But "PRAGMA foreign_keys = ON"
* command does not have any affect when using within transaction.
* Therefore, do not create transaction when executing TRUNCATE.
*/
if (!entry->truncatable)
/*
* Start a new transaction or subtransaction if needed.
*/
sqlite_begin_remote_xact(entry);
return entry->conn;
}
/*
* Open remote sqlite database using specified database path
* and flags of opened file descriptor mode.
*/
static sqlite3 *
sqlite_open_db(const char *dbpath, int flags)
{
sqlite3 *conn = NULL;
int rc;
char *err;
const char *zVfs = NULL;
rc = sqlite3_open_v2(dbpath, &conn, flags, zVfs);
if (rc != SQLITE_OK)
ereport(ERROR,
(errcode(ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION),
errmsg("Failed to open SQLite DB, file '%s', result code %d", dbpath, rc)));
/* make 'LIKE' of SQLite case sensitive like PostgreSQL */
rc = sqlite3_exec(conn, "pragma case_sensitive_like=1",
NULL, NULL, &err);
if (rc != SQLITE_OK)
{
char *perr = pstrdup(err);
sqlite3_free(err);
sqlite3_close(conn);
conn = NULL;
ereport(ERROR,
(errcode(ERRCODE_FDW_UNABLE_TO_ESTABLISH_CONNECTION),
errmsg("Failed to open SQLite DB, file '%s', SQLite error '%s', result code %d", dbpath, perr, rc)));
}
/* add included inner SQLite functions from separate c file
* for using in data unifying during deparsing
*/
sqlite_fdw_data_norm_functs_init(conn);
return conn;
}
/*
* Reset all transient state fields in the cached connection entry and
* establish new connection to the remote server.
*/
static void
sqlite_make_new_connection(ConnCacheEntry *entry, ForeignServer *server)
{
const char *dbpath = NULL;
ListCell *lc;
int flags = 0;
Assert(entry->conn == NULL);
entry->serverid = server->serverid;
entry->xact_depth = 0;
entry->invalidated = false;
entry->stmtList = NULL;
entry->keep_connections = true;
entry->readonly = false;
entry->server_hashvalue =
GetSysCacheHashValue1(FOREIGNSERVEROID,
ObjectIdGetDatum(server->serverid));
foreach(lc, server->options)
{
DefElem *def = (DefElem *) lfirst(lc);
if (strcmp(def->defname, "database") == 0)
dbpath = defGetString(def);
else if (strcmp(def->defname, "keep_connections") == 0)
entry->keep_connections = defGetBoolean(def);
else if (strcmp(def->defname, "force_readonly") == 0)
entry->readonly = defGetBoolean(def);
}
flags = flags | (entry->readonly ? SQLITE_OPEN_READONLY : SQLITE_OPEN_READWRITE);
/* Try to make the connection */
entry->conn = sqlite_open_db(dbpath, flags);
}
/*
* cleanup_connection:
* Delete all the cache entries on backend exists.
*/
void
sqlite_cleanup_connection(void)
{
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;
int rc;
if (ConnectionHash == NULL)
return;
hash_seq_init(&scan, ConnectionHash);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
if (entry->conn == NULL)
continue;
sqlite_finalize_list_stmt(&entry->stmtList);
elog(DEBUG1, "disconnecting sqlite_fdw connection %p", entry->conn);
rc = sqlite3_close(entry->conn);
entry->conn = NULL;
if (rc != SQLITE_OK)
{
ereport(ERROR,
(errcode(ERRCODE_FDW_UNABLE_TO_CREATE_EXECUTION),
errmsg("Failed to close SQLite DB"),
errhint("SQLite error '%s', SQLite result code %d", sqlite3_errmsg(entry->conn), rc)
));
}
}
}
/*
* Convenience subroutine to issue a non-data-returning SQL command to remote
*/
void
sqlite_do_sql_command(sqlite3 * conn, const char *sql, int level, List **busy_connection)
{
char *err = NULL;
int rc;
elog(DEBUG3, "sqlite_fdw do_sql_command %s", sql);
rc = sqlite3_exec(conn, sql, NULL, NULL, &err);
if (busy_connection && rc == SQLITE_BUSY)
{
/* Busy case will be handled later, not here */
BusyHandlerArg *arg = palloc0(sizeof(BusyHandlerArg));
arg->conn = conn;
arg->sql = sql;
arg->level = level;
*busy_connection = lappend(*busy_connection, arg);
return;
}
if (rc != SQLITE_OK)
{
char *perr = NULL;
if (err)
{
perr = pstrdup(err);
sqlite3_free(err);
if (perr)
{
ereport(level,
(errcode(ERRCODE_FDW_ERROR),
errmsg("SQLite failed to execute a query"),
errcontext("SQL query: %s", sql),
errhint("SQLite error '%s'", perr)));
pfree(perr);
}
}
else
ereport(level,
(errcode(ERRCODE_FDW_ERROR),
errmsg("SQLite failed to execute a query"),
errcontext("SQL query: %s", sql)
));
}
}
/*
* Start remote transaction or subtransaction, if needed.
*/
static void
sqlite_begin_remote_xact(ConnCacheEntry *entry)
{
int curlevel = GetCurrentTransactionNestLevel();
/* Start main transaction if we haven't yet */
if (entry->xact_depth <= 0)
{
const char *sql;
elog(DEBUG3, "starting remote transaction on connection %p",
entry->conn);
sql = "BEGIN";
sqlite_do_sql_command(entry->conn, sql, ERROR, NULL);
entry->xact_depth = 1;
}
/*
* If we're in a subtransaction, stack up savepoints to match our level.
* This ensures we can rollback just the desired effects when a
* subtransaction aborts.
*/
while (entry->xact_depth < curlevel)
{
char sql[64];
snprintf(sql, sizeof(sql), "SAVEPOINT s%d", entry->xact_depth + 1);
sqlite_do_sql_command(entry->conn, sql, ERROR, NULL);
entry->xact_depth++;
}
}
/*
* Report an SQLite execution error.
*/
void
sqlitefdw_report_error(int elevel, sqlite3_stmt * stmt, sqlite3 * conn,
const char *sql, int rc)
{
const char *message = sqlite3_errmsg(conn);
int erc = sqlite3_extended_errcode(conn);
int sqlstate = ERRCODE_FDW_ERROR;
/* copy sql before callling another SQLite API */
if (message)
message = pstrdup(message);
if (!sql && stmt)
{
sql = sqlite3_sql(stmt);
if (sql)
sql = pstrdup(sqlite3_sql(stmt));
}
ereport(ERROR,
(errcode(sqlstate),
errmsg("Failed to execute remote SQL"),
errcontext("SQL query: %s", sql ? sql : ""),
errhint("SQLite error '%s', SQLite primary result code %d, extended result code %d", message ? message : "", rc, erc)
));
}
/*
* sqlitefdw_xact_callback --- cleanup at main-transaction end.
*/
static void
sqlitefdw_xact_callback(XactEvent event, void *arg)
{
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;
ListCell *lc;
List *busy_connection = NIL;
/* Quick exit if no connections were touched in this transaction. */
if (!xact_got_connection)
return;
elog(DEBUG1, "sqlite_fdw xact_callback %d", event);
/*
* Scan all connection cache entries to find open remote transactions, and
* close them.
*/
hash_seq_init(&scan, ConnectionHash);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
/* Ignore cache entry if no open connection right now */
if (entry->conn == NULL)
continue;
/* If it has an open remote transaction, try to close it */
if (entry->xact_depth > 0)
{
elog(DEBUG3, "closing remote transaction on connection %p",
entry->conn);
switch (event)
{
case XACT_EVENT_PARALLEL_PRE_COMMIT:
case XACT_EVENT_PRE_COMMIT:
/* Commit all remote transactions during pre-commit */
if (!sqlite3_get_autocommit(entry->conn))
sqlite_do_sql_command(entry->conn, "COMMIT", ERROR, &busy_connection);
/* Finalize all prepared statements */
sqlite_finalize_list_stmt(&entry->stmtList);
break;
case XACT_EVENT_PRE_PREPARE:
/*
* We disallow remote transactions that modified anything,
* since it's not very reasonable to hold them open until
* the prepared transaction is committed. For the moment,
* throw error unconditionally; later we might allow
* read-only cases. Note that the error will cause us to
* come right back here with event == XACT_EVENT_ABORT, so
* we'll clean up the connection state at that point.
*/
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot prepare a transaction that modified remote tables")));
break;
case XACT_EVENT_PARALLEL_COMMIT:
case XACT_EVENT_COMMIT:
case XACT_EVENT_PREPARE:
/* Pre-commit should have closed the open transaction */
elog(ERROR, "missed cleaning up connection during pre-commit");
break;
case XACT_EVENT_PARALLEL_ABORT:
case XACT_EVENT_ABORT:
{
sqlitefdw_abort_cleanup(entry, true, &busy_connection);
break;
}
}
}
/* Reset state to show we're out of a transaction */
sqlitefdw_reset_xact_state(entry, true);
}
/* Execute again the query after server is available */
foreach(lc, busy_connection)
{
BusyHandlerArg *arg = lfirst(lc);
/*
* If there is still error, we can not do anything more, just raise it.
* requireBusyHandler is set to false, and NULL busy_connection list.
*/
sqlite_do_sql_command(arg->conn, arg->sql, arg->level, NULL);
}
list_free(busy_connection);
/*
* Regardless of the event type, we can now mark ourselves as out of the
* transaction. (Note: if we are here during PRE_COMMIT or PRE_PREPARE,
* this saves a useless scan of the hashtable during COMMIT or PREPARE.)
*/
xact_got_connection = false;
}
/*
* sqlitefdw_reset_xact_state --- Reset state to show we're out of a (sub)transaction
*/
static void
sqlitefdw_reset_xact_state(ConnCacheEntry *entry, bool toplevel) {
if (toplevel) {
/* Reset state to show we're out of a transaction */
entry->xact_depth = 0;
/*
* If the connection isn't in a good idle state, it is marked as
* invalid or keep_connections option of its server is disabled, then
* discard it to recover. Next GetConnection will open a new
* connection.
*/
if (entry->invalidated ||
!entry->keep_connections)
{
elog(DEBUG3, "discarding sqlite_fdw connection %p", entry->conn);
sqlite3_close(entry->conn);
entry->conn = NULL;
}
} else {
/* Reset state to show we're out of a subtransaction */
entry->xact_depth--;
}
}
/*
* sqlitefdw_subxact_callback --- cleanup at subtransaction end.
*/
static void
sqlitefdw_subxact_callback(SubXactEvent event, SubTransactionId mySubid,
SubTransactionId parentSubid, void *arg)
{
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;
int curlevel;
ListCell *lc;
List *busy_connection = NIL;
/* Nothing to do at subxact start, nor after commit. */
if (!(event == SUBXACT_EVENT_PRE_COMMIT_SUB ||
event == SUBXACT_EVENT_ABORT_SUB))
return;
/* Quick exit if no connections were touched in this transaction. */
if (!xact_got_connection)
return;
/*
* Scan all connection cache entries to find open remote subtransactions
* of the current level, and close them.
*/
curlevel = GetCurrentTransactionNestLevel();
hash_seq_init(&scan, ConnectionHash);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
char sql[100];
/*
* We only care about connections with open remote subtransactions of
* the current level.
*/
if (entry->conn == NULL || entry->xact_depth < curlevel)
continue;
if (entry->truncatable)
continue;
if (entry->xact_depth > curlevel)
elog(ERROR, "missed cleaning up remote subtransaction at level %d",
entry->xact_depth);
if (event == SUBXACT_EVENT_PRE_COMMIT_SUB)
{
/* Commit all remote subtransactions during pre-commit */
snprintf(sql, sizeof(sql), "RELEASE SAVEPOINT s%d", curlevel);
sqlite_do_sql_command(entry->conn, sql, ERROR, &busy_connection);
}
else if (in_error_recursion_trouble())
{
/*
* Don't try to clean up the connection if we're already in error
* recursion trouble.
*/
}
else
{
/* Rollback all remote subtransactions during abort */
sqlitefdw_abort_cleanup(entry, false, &busy_connection);
}
/* OK, we're outta that level of subtransaction */
sqlitefdw_reset_xact_state(entry, false);
}
/* Execute again the query after server is available */
foreach(lc, busy_connection)
{
BusyHandlerArg *arg = lfirst(lc);
/*
* If there is still error, we can not do anything more, just raise it.
* requireBusyHandler is set to false, and NULL busy_connection list.
*/
sqlite_do_sql_command(arg->conn, arg->sql, arg->level, NULL);
}
list_free(busy_connection);
}
/*
* Connection invalidation callback function
*
* After a change to a pg_foreign_server or pg_user_mapping catalog entry,
* mark connections depending on that entry as needing to be remade.
* We can't immediately destroy them, since they might be in the midst of
* a transaction, but we'll remake them at the next opportunity.
*
* Although most cache invalidation callbacks blow away all the related stuff
* regardless of the given hashvalue, connections are expensive enough that
* it's worth trying to avoid that.
*
* NB: We could avoid unnecessary disconnection more strictly by examining
* individual option values, but it seems too much effort for the gain.
*/
static void
sqlitefdw_inval_callback(Datum arg, int cacheid, uint32 hashvalue)
{
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;
Assert(cacheid == FOREIGNSERVEROID);
/* ConnectionHash must exist already, if we're registered */
hash_seq_init(&scan, ConnectionHash);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
/* Ignore invalid entries */
if (entry->conn == NULL)
continue;
/* hashvalue == 0 means a cache reset, must clear all state */
if (hashvalue == 0 ||
(cacheid == FOREIGNSERVEROID &&
entry->server_hashvalue == hashvalue))
{
/*
* Close the connection immediately if it's not used yet in this
* transaction. Otherwise mark it as invalid so that
* sqlitefdw_xact_callback() can close it at the end of this
* transaction.
*/
if (entry->xact_depth == 0)
{
elog(DEBUG3, "discarding sqlite_fdw connection %p", entry->conn);
sqlite3_close(entry->conn);
entry->conn = NULL;
}
else
entry->invalidated = true;
}
}
}
/*
* List active foreign server connections.
*
* This function takes no input parameter and returns setof record made of
* following values:
* - server_name - server name of active connection. In case the foreign server
* is dropped but still the connection is active, then the server name will
* be NULL in output.
* - valid - true/false representing whether the connection is valid or not.
* Note that the connections can get invalidated in sqlitefdw_inval_callback.
*
* No records are returned when there are no cached connections at all.
*/
Datum
sqlite_fdw_get_connections(PG_FUNCTION_ARGS)
{
#if PG_VERSION_NUM < 140000
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Function %s does not support in Postgres version %s", __func__, PG_VERSION)
));
#else
#define SQLITE_FDW_GET_CONNECTIONS_COLS 2
ReturnSetInfo *rsinfo = (ReturnSetInfo *) fcinfo->resultinfo;
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;
#if PG_VERSION_NUM < 150000
TupleDesc tupdesc;
Tuplestorestate *tupstore;
MemoryContext per_query_ctx;
MemoryContext oldcontext;
#endif
#if PG_VERSION_NUM >= 160000
InitMaterializedSRF(fcinfo, 0);
#elif PG_VERSION_NUM >= 150000
SetSingleFuncCall(fcinfo, 0);
#else
/* check to see if caller supports us returning a tuplestore */
if (rsinfo == NULL || !IsA(rsinfo, ReturnSetInfo))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("set-valued function called in context that cannot accept a set")));
if (!(rsinfo->allowedModes & SFRM_Materialize))
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("materialize mode required, but it is not allowed in this context")));
/* Build a tuple descriptor for our result type */
if (get_call_result_type(fcinfo, NULL, &tupdesc) != TYPEFUNC_COMPOSITE)
elog(ERROR, "return type must be a row type");
/* Build tuplestore to hold the result rows */
per_query_ctx = rsinfo->econtext->ecxt_per_query_memory;
oldcontext = MemoryContextSwitchTo(per_query_ctx);
tupstore = tuplestore_begin_heap(true, false, work_mem);
rsinfo->returnMode = SFRM_Materialize;
rsinfo->setResult = tupstore;
rsinfo->setDesc = tupdesc;
MemoryContextSwitchTo(oldcontext);
#endif
/* If cache doesn't exist, we return no records */
if (!ConnectionHash)
{
#if PG_VERSION_NUM < 150000
/* clean up and return the tuplestore */
tuplestore_donestoring(tupstore);
#endif
PG_RETURN_VOID();
}
hash_seq_init(&scan, ConnectionHash);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
ForeignServer *server;
Datum values[SQLITE_FDW_GET_CONNECTIONS_COLS] = {0};
bool nulls[SQLITE_FDW_GET_CONNECTIONS_COLS] = {0};
/* We only look for open remote connections */
if (!entry->conn)
continue;
server = GetForeignServerExtended(entry->serverid, FSV_MISSING_OK);
/*
* The foreign server may have been dropped in current explicit
* transaction. It is not possible to drop the server from another
* session when the connection associated with it is in use in the
* current transaction, if tried so, the drop query in another session
* blocks until the current transaction finishes.
*
* Even though the server is dropped in the current transaction, the
* cache can still have associated active connection entry, say we
* call such connections dangling. Since we can not fetch the server
* name from system catalogs for dangling connections, instead we show
* NULL value for server name in output.
*
* We could have done better by storing the server name in the cache
* entry instead of server oid so that it could be used in the output.
* But the server name in each cache entry requires 64 bytes of
* memory, which is huge, when there are many cached connections and
* the use case i.e. dropping the foreign server within the explicit
* current transaction seems rare. So, we chose to show NULL value for
* server name in output.
*
* Such dangling connections get closed either in next use or at the
* end of current explicit transaction in sqlitefdw_xact_callback.
*/
if (!server)
{
/*
* If the server has been dropped in the current explicit
* transaction, then this entry would have been invalidated in
* sqlitefdw_inval_callback at the end of drop server command.
* Note that this connection would not have been closed in
* sqlitefdw_inval_callback because it is still being used in the
* current explicit transaction. So, assert that here.
*/
Assert(entry->conn && entry->xact_depth > 0 && entry->invalidated);
/* Show null, if no server name was found */
nulls[0] = true;
}
else
values[0] = CStringGetTextDatum(server->servername);
values[1] = BoolGetDatum(!entry->invalidated);
#if PG_VERSION_NUM >= 150000
tuplestore_putvalues(rsinfo->setResult, rsinfo->setDesc, values, nulls);
#else
tuplestore_putvalues(tupstore, tupdesc, values, nulls);
#endif
}
#if PG_VERSION_NUM < 150000
/* clean up and return the tuplestore */
tuplestore_donestoring(tupstore);
#endif
PG_RETURN_VOID();
#endif
}
/*
* Disconnect the specified cached connections.
*
* This function discards the open connections that are established by
* sqlite_fdw from the local session to the foreign server with
* the given name. Note that there can be multiple connections to
* the given server using different user mappings. If the connections
* are used in the current local transaction, they are not disconnected
* and warning messages are reported. This function returns true
* if it disconnects at least one connection, otherwise false. If no
* foreign server with the given name is found, an error is reported.
*/
Datum
sqlite_fdw_disconnect(PG_FUNCTION_ARGS)
{
#if PG_VERSION_NUM < 140000
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Function %s does not support in Postgres version %s", __func__, PG_VERSION)
));
#else
ForeignServer *server;
char *servername;
servername = text_to_cstring(PG_GETARG_TEXT_PP(0));
server = GetForeignServerByName(servername, false);
PG_RETURN_BOOL(sqlite_disconnect_cached_connections(server->serverid));
#endif
}
/*
* Disconnect all the cached connections.
*
* This function discards all the open connections that are established by
* sqlite_fdw from the local session to the foreign servers.
* If the connections are used in the current local transaction, they are
* not disconnected and warning messages are reported. This function
* returns true if it disconnects at least one connection, otherwise false.
*/
Datum
sqlite_fdw_disconnect_all(PG_FUNCTION_ARGS)
{
#if PG_VERSION_NUM < 140000
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("Function %s does not support in Postgres version %s", __func__, PG_VERSION)
));
#else
PG_RETURN_BOOL(sqlite_disconnect_cached_connections(InvalidOid));
#endif
}
/*
* Abort remote transaction or subtransaction.
*
* "toplevel" should be set to true if toplevel (main) transaction is
* rollbacked, false otherwise.
*/
static void
sqlitefdw_abort_cleanup(ConnCacheEntry *entry, bool toplevel, List **busy_connection)
{
if (toplevel)
{
elog(DEBUG3, "abort transaction");
/* Finalize all prepared statements */
sqlite_finalize_list_stmt(&entry->stmtList);
/*
* rollback if in transaction because SQLite may
* already rollback
*/
if (!sqlite3_get_autocommit(entry->conn))
sqlite_do_sql_command(entry->conn, "ROLLBACK", WARNING, busy_connection);
}
else
{
char sql[100];
int curlevel = GetCurrentTransactionNestLevel();
snprintf(sql,
sizeof(sql),
"ROLLBACK TO SAVEPOINT s%d; RELEASE SAVEPOINT s%d",
curlevel,
curlevel
);
if (!sqlite3_get_autocommit(entry->conn))
sqlite_do_sql_command(entry->conn, sql, ERROR, busy_connection);
}
}
#if PG_VERSION_NUM >= 140000
/*
* Workhorse to disconnect cached connections.
*
* This function scans all the connection cache entries and disconnects
* the open connections whose foreign server OID matches with
* the specified one. If InvalidOid is specified, it disconnects all
* the cached connections.
*
* This function emits a warning for each connection that's used in
* the current transaction and doesn't close it. It returns true if
* it disconnects at least one connection, otherwise false.
*
* Note that this function disconnects even the connections that are
* established by other users in the same local session using different
* user mappings. This leads even non-superuser to be able to close
* the connections established by superusers in the same local session.
*
* XXX As of now we don't see any security risk doing this. But we should
* set some restrictions on that, for example, prevent non-superuser
* from closing the connections established by superusers even
* in the same session?
*/
static bool
sqlite_disconnect_cached_connections(Oid serverid)
{
HASH_SEQ_STATUS scan;
ConnCacheEntry *entry;
bool all = !OidIsValid(serverid);
bool result = false;
/*
* Connection cache hashtable has not been initialized yet in this
* session, so return false.
*/
if (!ConnectionHash)
return false;
hash_seq_init(&scan, ConnectionHash);
while ((entry = (ConnCacheEntry *) hash_seq_search(&scan)))
{
/* Ignore cache entry if no open connection right now. */
if (!entry->conn)
continue;
if (all || entry->serverid == serverid)
{
/*
* Emit a warning because the connection to close is used in the
* current transaction and cannot be disconnected right now.
*/
if (entry->xact_depth > 0)
{
ForeignServer *server;
server = GetForeignServerExtended(entry->serverid,
FSV_MISSING_OK);
if (!server)
{
/*
* If the foreign server was dropped while its connection
* was used in the current transaction, the connection
* must have been marked as invalid by
* sqlitefdw_inval_callback at the end of DROP SERVER
* command.
*/
Assert(entry->invalidated);
ereport(WARNING,
(errmsg("cannot close dropped server connection because it is still in use")));
}
else
ereport(WARNING,
(errmsg("cannot close connection for server \"%s\" because it is still in use",
server->servername)));
}
else
{
elog(DEBUG3, "discarding sqlite_fdw connection %p", entry->conn);
sqlite_finalize_list_stmt(&entry->stmtList);
sqlite3_close(entry->conn);
entry->conn = NULL;
result = true;
}
}
}
return result;
}
#endif
/*
* cache sqlite3 statement to finalize at the end of transaction
*/
void
sqlite_cache_stmt(ForeignServer *server, sqlite3_stmt * *stmt)
{
bool found;
ConnCacheEntry *entry;
ConnCacheKey key = server->serverid;
/*
* Find cached entry for requested connection.
*/
entry = hash_search(ConnectionHash, &key, HASH_ENTER, &found);
/* We must always have found the entry */
Assert(found);
entry->stmtList = sqlite_append_stmt_to_list(entry->stmtList, *stmt);
}
/*
* finalize all sqlite statement
*/
static void
sqlite_finalize_list_stmt(List **list)
{
ListCell *lc;
foreach(lc, *list)
{
sqlite3_stmt *stmt = (sqlite3_stmt *) lfirst(lc);
elog(DEBUG1, "sqlite_fdw: finalize %s", sqlite3_sql(stmt));
sqlite3_finalize(stmt);
}
list_free(*list);
*list = NULL;
}
/*
* append sqlite3 stmt to the head of linked list
*/
static List *
sqlite_append_stmt_to_list(List *list, sqlite3_stmt * stmt)
{
/*
* CurrentMemoryContext is released before cleanup transaction (when the
* list is called), so, use TopMemoryContext instead.
*/
MemoryContext oldcontext = MemoryContextSwitchTo(TopMemoryContext);
list = lappend(list, stmt);
MemoryContextSwitchTo(oldcontext);
return list;
}
================================================
FILE: deparse.c
================================================
/*-------------------------------------------------------------------------
*
* SQLite Foreign Data Wrapper for PostgreSQL
*
* Portions Copyright (c) 2018, TOSHIBA CORPORATION
*
* IDENTIFICATION
* deparse.c
*
*-------------------------------------------------------------------------
*/
#include "postgres.h"
#include "sqlite_fdw.h"
#include "catalog/pg_aggregate.h"
#include "catalog/pg_collation.h"
#include "catalog/pg_namespace.h"
#include "catalog/pg_operator.h"
#include "catalog/pg_proc.h"
#if PG_VERSION_NUM >= 160000
#include "catalog/pg_ts_config.h"
#endif
#include "catalog/pg_ts_dict.h"
#if (PG_VERSION_NUM < 130000)
#include "catalog/pg_type.h"
#endif
#include "commands/defrem.h"
#include "mb/pg_wchar.h"
#include "nodes/makefuncs.h"
#include "nodes/nodeFuncs.h"
#include "optimizer/tlist.h"
#include "parser/parsetree.h"
#include "parser/parse_type.h"
#include "utils/builtins.h"
#include "utils/lsyscache.h"
#include "utils/syscache.h"
#include "utils/typcache.h"
/*
* Global context for sqlite_foreign_expr_walker's search of an expression tree.
*/
typedef struct foreign_glob_cxt
{
PlannerInfo *root; /* global planner state */
RelOptInfo *foreignrel; /* the foreign relation we are planning for */
Relids relids; /* relids of base relations in the underlying
* scan */
} foreign_glob_cxt;
/*
* Local (per-tree-level) context for sqlite_foreign_expr_walker's search.
* This is concerned with identifying collations used in the expression.
*/
typedef enum
{
FDW_COLLATE_NONE, /* expression is of a noncollatable type */
FDW_COLLATE_SAFE, /* collation derives from a foreign Var */
FDW_COLLATE_UNSAFE, /* collation derives from something else */
} FDWCollateState;
typedef struct foreign_loc_cxt
{
Oid collation; /* OID of current collation, if any */
FDWCollateState state; /* state of current collation choice */
} foreign_loc_cxt;
/*
* Context for sqlite_deparse_expr
*/
typedef struct deparse_expr_cxt
{
PlannerInfo *root; /* global planner state */
RelOptInfo *foreignrel; /* the foreign relation we are planning for */
RelOptInfo *scanrel; /* the underlying scan relation. Same as
* foreignrel, when that represents a join or
* a base relation. */
StringInfo buf; /* output buffer to append to */
List **params_list; /* exprs that will become remote Params */
Expr *complementarynode; /* variable where we can store, only if
* needed, a complementary node to obtain
* info for processing actual node.
* Created mostly for
* sqlite_deparse_op_expr to have both
* nodes accesible during each node
* deparse. */
} deparse_expr_cxt;
#define QUOTE '"'
#define REL_ALIAS_PREFIX "r"
/* Handy macro to add relation name qualification */
#define ADD_REL_QUALIFIER(buf, varno) \
appendStringInfo((buf), "%s%d.", REL_ALIAS_PREFIX, (varno))
#define SUBQUERY_REL_ALIAS_PREFIX "s"
#define SUBQUERY_COL_ALIAS_PREFIX "c"
/*
* Functions to determine whether an expression can be evaluated safely on
* remote server.
*/
static bool sqlite_foreign_expr_walker(Node *node,
foreign_glob_cxt *glob_cxt,
foreign_loc_cxt *outer_cxt,
foreign_loc_cxt *case_arg_cxt);
/*
* Functions to construct string representation of a node tree.
*/
static void sqlite_deparse_expr(Expr *node, deparse_expr_cxt *context);
static void sqlite_deparse_var(Var *node, deparse_expr_cxt *context);
static void sqlite_deparse_const(Const *node, deparse_expr_cxt *context, int showtype);
static void sqlite_deparse_param(Param *node, deparse_expr_cxt *context);
static void sqlite_deparse_func_expr(FuncExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_op_expr(OpExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_operator_name(StringInfo buf, Form_pg_operator opform);
static void sqlite_deparse_scalar_array_op_expr(ScalarArrayOpExpr *node,
deparse_expr_cxt *context);
static void sqlite_deparse_relabel_type(RelabelType *node, deparse_expr_cxt *context);
static void sqlite_deparse_bool_expr(BoolExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_null_test(NullTest *node, deparse_expr_cxt *context);
static void sqlite_deparse_case_expr(CaseExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_array_expr(ArrayExpr *node, deparse_expr_cxt *context);
static void sqlite_print_remote_param(int paramindex, Oid paramtype, int32 paramtypmod,
deparse_expr_cxt *context);
static void sqlite_print_remote_placeholder(Oid paramtype, int32 paramtypmod,
deparse_expr_cxt *context);
static void sqlite_deparse_relation(StringInfo buf, Relation rel);
static void sqlite_deparse_target_list(StringInfo buf, PlannerInfo *root, Index rtindex, Relation rel,
Bitmapset *attrs_used, bool qualify_col, List **retrieved_attrs, bool is_concat, bool check_null);
static void sqlite_deparse_column_ref(StringInfo buf, int varno, int varattno, PlannerInfo *root, bool qualify_col, bool dml_context);
static void sqlite_deparse_select(List *tlist, bool is_subquery, List **retrieved_attrs, deparse_expr_cxt *context);
static void sqlite_deparse_subquery_target_list(deparse_expr_cxt *context);
static void sqlite_deparse_case_expr(CaseExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_null_if_expr(NullIfExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_coalesce_expr(CoalesceExpr *node, deparse_expr_cxt *context);
static void sqlite_deparse_from_expr_for_rel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
bool use_alias, Index ignore_rel, List **ignore_conds,
#if PG_VERSION_NUM >= 170000
List **additional_conds,
#endif
List **params_list);
#if PG_VERSION_NUM >= 170000
static void sqlite_append_where_clause(List *exprs, List *additional_conds,
deparse_expr_cxt *context);
#endif
static void sqlite_deparse_range_tbl_ref(StringInfo buf, PlannerInfo *root,
RelOptInfo *foreignrel, bool make_subquery,
Index ignore_rel, List **ignore_conds,
#if PG_VERSION_NUM >= 170000
List **additional_conds,
#endif
List **params_list);
static void sqlite_deparse_from_expr(List *quals, deparse_expr_cxt *context);
static void sqlite_deparse_aggref(Aggref *node, deparse_expr_cxt *context);
static void sqlite_append_limit_clause(deparse_expr_cxt *context);
static void sqlite_append_conditions(List *exprs, deparse_expr_cxt *context);
static void sqlite_append_group_by_clause(List *tlist, deparse_expr_cxt *context);
static void sqlite_append_agg_order_by(List *orderList, List *targetList,
deparse_expr_cxt *context);
static void sqlite_append_order_by_clause(List *pathkeys, bool has_final_sort, deparse_expr_cxt *context);
static void sqlite_append_order_by_suffix(Oid sortop, Oid sortcoltype, bool nulls_first,
deparse_expr_cxt *context);
static void sqlite_append_function_name(Oid funcid, deparse_expr_cxt *context);
const char *sqlite_get_jointype_name(JoinType jointype);
static Node *sqlite_deparse_sort_group_clause(Index ref, List *tlist, bool force_colno,
deparse_expr_cxt *context);
static void sqlite_deparse_explicit_target_list(List *tlist, List **retrieved_attrs,
deparse_expr_cxt *context);
/*
* Helper functions
*/
static bool sqlite_is_subquery_var(Var *node, RelOptInfo *foreignrel,
int *relno, int *colno);
static void sqlite_get_relation_column_alias_ids(Var *node, RelOptInfo *foreignrel,
int *relno, int *colno);
static char *sqlite_quote_identifier(const char *s, char q);
static bool sqlite_contain_immutable_functions_walker(Node *node, void *context);
static bool sqlite_deparsable_data_type(Param *p);
static int preferred_sqlite_affinity (Oid relid, int varattno);
/*
* Append remote name of specified foreign table to buf.
* Use value of table_name FDW option (if any) instead of relation's name.
* Similarly, schema_name FDW option overrides schema name.
*/
static void
sqlite_deparse_relation(StringInfo buf, Relation rel)
{
ForeignTable *table;
const char *relname = NULL;
ListCell *lc = NULL;
/* obtain additional catalog information. */
table = GetForeignTable(RelationGetRelid(rel));
/*
* Use value of FDW options if any, instead of the name of object itself.
*/
foreach(lc, table->options)
{
DefElem *def = (DefElem *) lfirst(lc);
if (strcmp(def->defname, "table") == 0)
relname = defGetString(def);
}
if (relname == NULL)
relname = RelationGetRelationName(rel);
/* always use main database for SQLite */
appendStringInfo(buf, "%s.%s", "main", sqlite_quote_identifier(relname, QUOTE));
}
static char *
sqlite_quote_identifier(const char *s, char q)
{
char *result = palloc(strlen(s) * 2 + 3);
char *r = result;
*r++ = q;
while (*s)
{
if (*s == q)
*r++ = *s;
*r++ = *s;
s++;
}
*r++ = q;
*r++ = '\0';
return result;
}
/*
* Returns true if given expr is safe to evaluate on the foreign server.
*/
bool
sqlite_is_foreign_expr(PlannerInfo *root,
RelOptInfo *baserel,
Expr *expr)
{
foreign_glob_cxt glob_cxt;
foreign_loc_cxt loc_cxt;
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) (baserel->fdw_private);
/*
* Check that the expression consists of nodes that are safe to execute
* remotely.
*/
glob_cxt.root = root;
glob_cxt.foreignrel = baserel;
/*
* For an upper relation, use relids from its underneath scan relation,
* because the upperrel's own relids currently aren't set to anything
* meaningful by the core code. For other relation, use their own relids.
*/
if (IS_UPPER_REL(baserel))
glob_cxt.relids = fpinfo->outerrel->relids;
else
glob_cxt.relids = baserel->relids;
loc_cxt.collation = InvalidOid;
loc_cxt.state = FDW_COLLATE_NONE;
if (!sqlite_foreign_expr_walker((Node *) expr, &glob_cxt, &loc_cxt, NULL))
return false;
/*
* If the expression has a valid collation that does not arise from a
* foreign var, the expression can not be sent over.
*/
if (loc_cxt.state == FDW_COLLATE_UNSAFE)
return false;
/*
* An expression which includes any mutable functions can't be sent over
* because its result is not stable. For example, sending now() remote
* side could cause confusion from clock offsets. Future versions might
* be able to make this choice with more granularity. (We check this last
* because it requires a lot of expensive catalog lookups.)
*/
if (contain_mutable_functions((Node *) expr))
return false;
/* OK to evaluate on the remote server */
return true;
}
/*
* Returns true if given expr is something we'd have to send the value of
* to the foreign server.
*
* This should return true when the expression is a shippable node that
* deparseExpr would add to context->params_list. Note that we don't care
* if the expression *contains* such a node, only whether one appears at top
* level. We need this to detect cases where setrefs.c would recognize a
* false match between an fdw_exprs item (which came from the params_list)
* and an entry in fdw_scan_tlist (which we're considering putting the given
* expression into).
*/
bool
sqlite_is_foreign_param(PlannerInfo *root,
RelOptInfo *baserel,
Expr *expr)
{
if (expr == NULL)
return false;
switch (nodeTag(expr))
{
case T_Var:
{
/* It would have to be sent unless it's a foreign Var */
Var *var = (Var *) expr;
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) (baserel->fdw_private);
Relids relids;
if (IS_UPPER_REL(baserel))
relids = fpinfo->outerrel->relids;
else
relids = baserel->relids;
if (bms_is_member(var->varno, relids) && var->varlevelsup == 0)
return false; /* foreign Var, so not a param */
else
return true; /* it'd have to be a param */
break;
}
case T_Param:
/* Params always have to be sent to the foreign server */
return true;
default:
break;
}
return false;
}
/*
* sqlite_deparsable_data_type:
*
* Checks if values of the data type with given Oid can be deparsed
* to SQLite data type.
*/
static bool
sqlite_deparsable_data_type(Param *p)
{
Oid type = p->paramtype;
switch (type)
{
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
case VARCHAROID:
case TEXTOID:
case TIMEOID:
case TIMESTAMPOID:
case TIMESTAMPTZOID:
case UUIDOID:
case MACADDROID:
case MACADDR8OID:
case JSONOID:
case JSONBOID:
return true;
}
#ifdef SQLITE_FDW_GIS_ENABLE
/* PostGIS data types can be supported only by name */
if (listed_datatype_oid(type, p->paramtypmod, postGisSQLiteCompatibleTypes))
{
return true;
}
#endif
return false;
}
/*
* Returns true if it's safe to push down the sort expression described by
* 'pathkey' to the foreign server.
*/
bool
sqlite_is_foreign_pathkey(PlannerInfo *root,
RelOptInfo *baserel,
PathKey *pathkey)
{
EquivalenceClass *pathkey_ec = pathkey->pk_eclass;
EquivalenceMember *em;
/*
* is_foreign_expr would detect volatile expressions as well, but checking
* ec_has_volatile here saves some cycles.
*/
if (pathkey_ec->ec_has_volatile)
return false;
/* can't push down the sort if the pathkey's opfamily is not built-in */
if (!sqlite_is_builtin(pathkey->pk_opfamily))
return false;
/* Find a suitable EC member */
em = sqlite_find_em_for_rel(root, pathkey_ec, baserel);
if (em)
{
Oid oprid;
TypeCacheEntry *typentry;
oprid = get_opfamily_member(pathkey->pk_opfamily,
em->em_datatype,
em->em_datatype,
pathkey->pk_strategy);
if (!OidIsValid(oprid))
elog(ERROR, "missing operator %d(%u,%u) in opfamily %u",
pathkey->pk_strategy, em->em_datatype, em->em_datatype,
pathkey->pk_opfamily);
/* See whether operator is default < or > for sort expr's datatype. */
typentry = lookup_type_cache(exprType((Node *) em->em_expr),
TYPECACHE_LT_OPR | TYPECACHE_GT_OPR);
/* SQLite does not support USING, so do not push down it */
if (oprid != typentry->lt_opr && oprid != typentry->gt_opr)
return false;
}
else
return false;
return true;
}
/*
* Check if expression is safe to execute remotely, and return true if so.
*
* In addition, *outer_cxt is updated with collation information.
*
* We must check that the expression contains only node types we can deparse,
* that all types/functions/operators are safe to send (which we approximate
* as being built-in), and that all collations used in the expression derive
* from Vars of the foreign table. Because of the latter, the logic is
* pretty close to assign_collations_walker() in parse_collate.c, though we
* can assume here that the given expression is valid.
*/
static bool
sqlite_foreign_expr_walker(Node *node,
foreign_glob_cxt *glob_cxt,
foreign_loc_cxt *outer_cxt,
foreign_loc_cxt *case_arg_cxt)
{
bool check_type = true;
foreign_loc_cxt inner_cxt;
Oid collation = InvalidOid;
FDWCollateState state = FDW_COLLATE_NONE;
HeapTuple tuple;
/* Need do nothing for empty subexpressions */
if (node == NULL)
return true;
/* Set up inner_cxt for possible recursion to child nodes */
inner_cxt.collation = InvalidOid;
inner_cxt.state = FDW_COLLATE_NONE;
switch (nodeTag(node))
{
case T_Var:
{
Var *var = (Var *) node;
elog(DEBUG2, "sqlite_fdw : %s T_Var", __func__);
/*
* If the Var is from the foreign table, we consider its
* collation (if any) safe to use. If it is from another
* table, we treat its collation the same way as we would a
* Param's collation, ie it's not safe for it to have a
* non-default collation.
*/
if (bms_is_member(var->varno, glob_cxt->relids) &&
var->varlevelsup == 0)
{
/* Var belongs to foreign table */
/*
* System columns (e.g. oid, ctid) should not be sent to
* the remote, since we don't make any effort to ensure
* that local and remote values match (tableoid, in
* particular, almost certainly doesn't match).
*/
if (var->varattno < 0)
return false;
/* Else check the collation */
collation = var->varcollid;
state = OidIsValid(collation) ? FDW_COLLATE_SAFE : FDW_COLLATE_NONE;
}
else
{
/* Var belongs to some other table */
collation = var->varcollid;
if (collation == InvalidOid ||
collation == DEFAULT_COLLATION_OID)
{
/*
* It's noncollatable, or it's safe to combine with a
* collatable foreign Var, so set state to NONE.
*/
state = FDW_COLLATE_NONE;
}
else
{
/*
* Do not fail right away, since the Var might appear
* in a collation-insensitive context.
*/
state = FDW_COLLATE_UNSAFE;
}
}
}
break;
case T_Const:
{
Const *c = (Const *) node;
elog(DEBUG2, "sqlite_fdw : %s T_Const", __func__);
/* SQLite cannot handle interval type */
if (c->consttype == INTERVALOID)
return false;
/*
* If the constant has nondefault collation, either it's of a
* non-builtin type, or it reflects folding of a CollateExpr;
* either way, it's unsafe to send to the remote.
*/
if (c->constcollid != InvalidOid &&
c->constcollid != DEFAULT_COLLATION_OID)
return false;
/* Otherwise, we can consider that it doesn't set collation */
collation = InvalidOid;
state = FDW_COLLATE_NONE;
}
break;
case T_CaseTestExpr:
{
CaseTestExpr *c = (CaseTestExpr *) node;
elog(DEBUG2, "sqlite_fdw : %s T_CaseTestExpr", __func__);
/* Punt if we seem not to be inside a CASE arg WHEN. */
if (!case_arg_cxt)
return false;
/*
* Otherwise, any nondefault collation attached to the
* CaseTestExpr node must be derived from foreign Var(s) in
* the CASE arg.
*/
collation = c->collation;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (case_arg_cxt->state == FDW_COLLATE_SAFE &&
collation == case_arg_cxt->collation)
state = FDW_COLLATE_SAFE;
else if (collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_NONE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_Param:
{
Param *p = (Param *) node;
elog(DEBUG2, "sqlite_fdw : %s T_Param", __func__);
/*
* If it's a MULTIEXPR Param, punt. We can't tell from here
* whether the referenced sublink/subplan contains any remote
* Vars; if it does, handling that is too complicated to
* consider supporting at present. Fortunately, MULTIEXPR
* Params are not reduced to plain PARAM_EXEC until the end of
* planning, so we can easily detect this case. (Normal
* PARAM_EXEC Params are safe to ship because their values
* come from somewhere else in the plan tree; but a MULTIEXPR
* references a sub-select elsewhere in the same targetlist,
* so we'd be on the hook to evaluate it somehow if we wanted
* to handle such cases as direct foreign updates.)
*/
if (p->paramkind == PARAM_MULTIEXPR)
return false;
if (!sqlite_deparsable_data_type(p))
return false;
/*
* Collation rule is same as for Consts and non-foreign Vars.
*/
collation = p->paramcollid;
if (collation == InvalidOid ||
collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_NONE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_FuncExpr:
{
FuncExpr *func = (FuncExpr *) node;
char *opername = NULL;
Oid schema;
elog(DEBUG2, "sqlite_fdw : %s T_FuncExpr", __func__);
/* get function name and schema */
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(func->funcid));
if (!HeapTupleIsValid(tuple))
{
elog(ERROR, "cache lookup failed for function %u", func->funcid);
}
opername = pstrdup(((Form_pg_proc) GETSTRUCT(tuple))->proname.data);
schema = ((Form_pg_proc) GETSTRUCT(tuple))->pronamespace;
ReleaseSysCache(tuple);
/* ignore functions in other than the pg_catalog schema */
if (schema != PG_CATALOG_NAMESPACE)
return false;
/*
* These function can be passed to SQLite. In case of nest
* functions, for example, (round(abs(c1), 0) = 1, the
* postgres core will transform to
* (round((abs(t1.c1))::numeric, 0) = '1'::numeric), so
* "::numberic" is kind of function format
* COERCE_IMPLICIT_CAST we must check.
*
* In SQLite, lower/upper function does not support UNICODE
* character, so we don't push down these functions.
*
*/
if (!(func->funcformat == COERCE_IMPLICIT_CAST
|| strcmp(opername, "abs") == 0
|| strcmp(opername, "btrim") == 0
|| strcmp(opername, "length") == 0
|| strcmp(opername, "ltrim") == 0
|| strcmp(opername, "replace") == 0
|| strcmp(opername, "round") == 0
|| strcmp(opername, "rtrim") == 0
|| strcmp(opername, "substr") == 0
|| strcmp(opername, "mod") == 0 ))
{
return false;
}
if (!sqlite_foreign_expr_walker((Node *) func->args,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/*
* If function's input collation is not derived from a foreign
* Var, it can't be sent to remote.
*/
if (func->inputcollid == InvalidOid)
/* OK, inputs are all noncollatable */ ;
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
func->inputcollid != inner_cxt.collation)
return false;
/*
* Detect whether node is introducing a collation not derived
* from a foreign Var. (If so, we just mark it unsafe for now
* rather than immediately returning false, since the parent
* node might not care.)
*/
collation = func->funccollid;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (inner_cxt.state == FDW_COLLATE_SAFE &&
collation == inner_cxt.collation)
state = FDW_COLLATE_SAFE;
else if (collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_NONE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_OpExpr:
case T_NullIfExpr:
{
char *cur_opname = NULL;
OpExpr *oe = (OpExpr *) node;
Form_pg_operator form;
Oid oprleft = InvalidOid;
Oid oprright = InvalidOid;
bool non_builtin_pushable_opr = false;
elog(DEBUG2, "sqlite_fdw : %s T_OpExpr|T_NullIfExpr", __func__);
tuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(oe->opno));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for operator %u", oe->opno);
form = (Form_pg_operator) GETSTRUCT(tuple);
/* opname is not a SQL identifier, so we should not quote it. */
cur_opname = pstrdup(NameStr(form->oprname));
oprleft = form->oprleft;
oprright = form->oprright;
ReleaseSysCache(tuple);
/*
* Similarly, only built-in or PostGIS = operators can be
* sent to remote. (If the operator is remote executable,
* surely its underlying function is too.)
*/
if (!sqlite_is_builtin(oe->opno))
{
/*
* Predicate of non built-in operators possible
* can be pushed down. For example, some PostGIS oparators.
*/
if ((strcmp(cur_opname, "=") == 0))
non_builtin_pushable_opr = true; /* Set it to true for later check */
else
return false;
}
/*
* Factorial (!) and Bitwise XOR (^), (#)
* cannot be pushed down to SQLite
* Full list see in https://www.postgresql.org/docs/current/functions-bitstring.html
* ILIKE cannot be pushed down to SQLite
* Full list see in https://www.postgresql.org/docs/current/functions-matching.html
*/
if (strcmp(cur_opname, "!") == 0
|| strcmp(cur_opname, "^") == 0
|| strcmp(cur_opname, "#") == 0
|| strcmp(cur_opname, "~~*") == 0
|| strcmp(cur_opname, "!~~*") == 0
/* JSON/JSONB operators with array or
* other JSON/JSONB or
* jsonpath as right operand
* https://www.postgresql.org/docs/current/functions-json.html
*/
|| ((oprleft == JSONOID || oprleft == JSONBOID)
&& (strcmp(cur_opname, "#>") == 0
|| strcmp(cur_opname, "#>>") == 0
|| strcmp(cur_opname, "@>") == 0
|| strcmp(cur_opname, "<@") == 0
|| strcmp(cur_opname, "?|") == 0
|| strcmp(cur_opname, "?&") == 0
|| strcmp(cur_opname, "@?") == 0
|| strcmp(cur_opname, "@@") == 0
|| strcmp(cur_opname, "||") == 0
|| strcmp(cur_opname, "?") == 0
|| strcmp(cur_opname, "-") == 0
|| strcmp(cur_opname, "#-") == 0
|| strcmp(cur_opname, "#-?") == 0
)))
{
return false;
}
if (non_builtin_pushable_opr)
{
/* If left operand is not PostGIS supported data type, do not push down */
if (sqlite_is_builtin(oprleft) || (!listed_datatype_oid(oprleft, -1, postGisSQLiteCompatibleTypes)))
return false;
/* If right operand is not PostGIS supported data type, do not push down */
if (sqlite_is_builtin(oprright) || (!listed_datatype_oid(oprright, -1, postGisSQLiteCompatibleTypes)))
return false;
/* Log operator for potential pushing down */
elog(DEBUG2, "sqlite_fdw : %s pushable PostGIS operator", cur_opname);
}
/*
* Recurse to input subexpressions.
*/
if (!sqlite_foreign_expr_walker((Node *) oe->args,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/*
* If operator's input collation is not derived from a foreign
* Var, it can't be sent to remote.
*/
if (oe->inputcollid == InvalidOid)
/* OK, inputs are all noncollatable */ ;
else if ((inner_cxt.state != FDW_COLLATE_SAFE ||
oe->inputcollid != inner_cxt.collation) &&
oprleft != JSONOID &&
oprleft != JSONBOID)
{
elog(DEBUG2, "sqlite_fdw : %s collate problems, do not push\n input coll %d, cxt coll %d, operator %d %s %d, ctxst %d", __func__, oe->inputcollid, inner_cxt.collation, oprleft, cur_opname, oprright, inner_cxt.state);
return false;
}
/* Result-collation handling is same as for functions */
collation = oe->opcollid;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (inner_cxt.state == FDW_COLLATE_SAFE &&
collation == inner_cxt.collation)
state = FDW_COLLATE_SAFE;
else if (collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_SAFE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_ScalarArrayOpExpr:
{
ScalarArrayOpExpr *oe = (ScalarArrayOpExpr *) node;
elog(DEBUG2, "sqlite_fdw : %s T_ScalarArrayOpExpr", __func__);
/*
* Again, only built-in operators can be sent to remote.
*/
if (!sqlite_is_builtin(oe->opno))
return false;
/*
* Recurse to input subexpressions.
*/
if (!sqlite_foreign_expr_walker((Node *) oe->args,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/*
* If operator's input collation is not derived from a foreign
* Var, it can't be sent to remote.
*/
if (oe->inputcollid == InvalidOid)
/* OK, inputs are all noncollatable */ ;
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
oe->inputcollid != inner_cxt.collation)
return false;
/* Output is always boolean and so noncollatable. */
collation = InvalidOid;
state = FDW_COLLATE_NONE;
}
break;
case T_RelabelType:
{
RelabelType *r = (RelabelType *) node;
elog(DEBUG2, "sqlite_fdw : %s T_RelabelType", __func__);
/*
* Recurse to input subexpression.
*/
if (!sqlite_foreign_expr_walker((Node *) r->arg,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/*
* RelabelType must not introduce a collation not derived from
* an input foreign Var.
*/
collation = r->resultcollid;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (inner_cxt.state == FDW_COLLATE_SAFE &&
collation == inner_cxt.collation)
state = FDW_COLLATE_SAFE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_BoolExpr:
{
BoolExpr *b = (BoolExpr *) node;
elog(DEBUG2, "sqlite_fdw : %s T_BoolExpr", __func__);
/*
* Recurse to input subexpressions.
*/
if (!sqlite_foreign_expr_walker((Node *) b->args,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/* Output is always boolean and so noncollatable. */
collation = InvalidOid;
state = FDW_COLLATE_NONE;
}
break;
case T_NullTest:
{
NullTest *nt = (NullTest *) node;
elog(DEBUG2, "sqlite_fdw : %s T_NullTest", __func__);
/*
* Recurse to input subexpressions.
*/
if (!sqlite_foreign_expr_walker((Node *) nt->arg,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/* Output is always boolean and so noncollatable. */
collation = InvalidOid;
state = FDW_COLLATE_NONE;
}
break;
case T_List:
{
List *l = (List *) node;
ListCell *lc;
elog(DEBUG2, "sqlite_fdw : %s T_List", __func__);
/*
* Recurse to component subexpressions.
*/
foreach(lc, l)
{
if (!sqlite_foreign_expr_walker((Node *) lfirst(lc),
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
}
/*
* When processing a list, collation state just bubbles up
* from the list elements.
*/
collation = inner_cxt.collation;
state = inner_cxt.state;
/* Don't apply exprType() to the list. */
check_type = false;
}
break;
case T_CoalesceExpr:
{
CoalesceExpr *coalesce = (CoalesceExpr *) node;
ListCell *lc;
elog(DEBUG2, "sqlite_fdw : %s T_CoalesceExpr", __func__);
if (list_length(coalesce->args) < 2)
return false;
/* Recurse to each argument */
foreach(lc, coalesce->args)
{
if (!sqlite_foreign_expr_walker((Node *) lfirst(lc),
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
}
}
break;
case T_CaseExpr:
{
CaseExpr *ce = (CaseExpr *) node;
foreign_loc_cxt arg_cxt;
foreign_loc_cxt tmp_cxt;
ListCell *lc;
elog(DEBUG2, "sqlite_fdw : %s T_CaseExpr", __func__);
/*
* Recurse to CASE's arg expression, if any. Its collation
* has to be saved aside for use while examining CaseTestExprs
* within the WHEN expressions.
*/
arg_cxt.collation = InvalidOid;
arg_cxt.state = FDW_COLLATE_NONE;
if (ce->arg)
{
if (!sqlite_foreign_expr_walker((Node *) ce->arg,
glob_cxt, &arg_cxt, case_arg_cxt))
return false;
}
/* Examine the CaseWhen subexpressions. */
foreach(lc, ce->args)
{
CaseWhen *cw = lfirst_node(CaseWhen, lc);
if (ce->arg)
{
/*
* In a CASE-with-arg, the parser should have produced
* WHEN clauses of the form "CaseTestExpr = RHS",
* possibly with an implicit coercion inserted above
* the CaseTestExpr. However in an expression that's
* been through the optimizer, the WHEN clause could
* be almost anything (since the equality operator
* could have been expanded into an inline function).
* In such cases forbid pushdown, because
* deparseCaseExpr can't handle it.
*/
Node *whenExpr = (Node *) cw->expr;
List *opArgs;
if (!IsA(whenExpr, OpExpr))
return false;
opArgs = ((OpExpr *) whenExpr)->args;
if (list_length(opArgs) != 2 ||
!IsA(strip_implicit_coercions(linitial(opArgs)),
CaseTestExpr))
return false;
}
/*
* Recurse to WHEN expression, passing down the arg info.
* Its collation doesn't affect the result (really, it
* should be boolean and thus not have a collation).
*/
tmp_cxt.collation = InvalidOid;
tmp_cxt.state = FDW_COLLATE_NONE;
if (!sqlite_foreign_expr_walker((Node *) cw->expr,
glob_cxt, &tmp_cxt, &arg_cxt))
return false;
/* Recurse to THEN expression. */
if (!sqlite_foreign_expr_walker((Node *) cw->result,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
}
/* Recurse to ELSE expression. */
if (!sqlite_foreign_expr_walker((Node *) ce->defresult,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/*
* Detect whether node is introducing a collation not derived
* from a foreign Var. (If so, we just mark it unsafe for now
* rather than immediately returning false, since the parent
* node might not care.) This is the same as for function
* nodes, except that the input collation is derived from only
* the THEN and ELSE subexpressions.
*/
collation = ce->casecollid;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (inner_cxt.state == FDW_COLLATE_SAFE &&
collation == inner_cxt.collation)
state = FDW_COLLATE_SAFE;
else if (collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_NONE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_Aggref:
{
Aggref *agg = (Aggref *) node;
ListCell *lc;
char *opername = NULL;
Oid schema;
elog(DEBUG2, "sqlite_fdw : %s T_Aggref", __func__);
/* get function name and schema */
tuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(agg->aggfnoid));
if (!HeapTupleIsValid(tuple))
{
elog(ERROR, "cache lookup failed for function %u", agg->aggfnoid);
}
opername = pstrdup(((Form_pg_proc) GETSTRUCT(tuple))->proname.data);
schema = ((Form_pg_proc) GETSTRUCT(tuple))->pronamespace;
ReleaseSysCache(tuple);
/* ignore functions in other than the pg_catalog schema */
if (schema != PG_CATALOG_NAMESPACE)
return false;
/* these function can be passed to SQLite */
if (!(strcmp(opername, "sum") == 0
|| strcmp(opername, "avg") == 0
|| strcmp(opername, "max") == 0
|| strcmp(opername, "min") == 0
|| strcmp(opername, "count") == 0))
{
return false;
}
/* Not safe to pushdown when not in grouping context */
if (!IS_UPPER_REL(glob_cxt->foreignrel))
return false;
/* Only non-split aggregates are pushable. */
if (agg->aggsplit != AGGSPLIT_SIMPLE)
return false;
/*
* Recurse to input args. aggdirectargs, aggorder and
* aggdistinct are all present in args, so no need to check
* their shippability explicitly.
*/
foreach(lc, agg->args)
{
Node *n = (Node *) lfirst(lc);
/* If TargetEntry, extract the expression from it */
if (IsA(n, TargetEntry))
{
TargetEntry *tle = (TargetEntry *) n;
n = (Node *) tle->expr;
}
if (!sqlite_foreign_expr_walker(n, glob_cxt, &inner_cxt, case_arg_cxt))
return false;
}
if (agg->aggorder || agg->aggfilter)
{
return false;
}
/*
* If aggregate's input collation is not derived from a
* foreign Var, it can't be sent to remote.
*/
if (agg->inputcollid == InvalidOid)
/* OK, inputs are all noncollatable */ ;
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
agg->inputcollid != inner_cxt.collation)
return false;
/*
* Detect whether node is introducing a collation not derived
* from a foreign Var. (If so, we just mark it unsafe for now
* rather than immediately returning false, since the parent
* node might not care.)
*/
collation = agg->aggcollid;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (inner_cxt.state == FDW_COLLATE_SAFE &&
collation == inner_cxt.collation)
state = FDW_COLLATE_SAFE;
else if (collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_NONE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_ArrayExpr:
{
ArrayExpr *a = (ArrayExpr *) node;
elog(DEBUG2, "sqlite_fdw : %s T_ArrayExpr", __func__);
/*
* Recurse to input subexpressions.
*/
if (!sqlite_foreign_expr_walker((Node *) a->elements,
glob_cxt, &inner_cxt, case_arg_cxt))
return false;
/*
* ArrayExpr must not introduce a collation not derived from
* an input foreign Var (same logic as for a function).
*/
collation = a->array_collid;
if (collation == InvalidOid)
state = FDW_COLLATE_NONE;
else if (inner_cxt.state == FDW_COLLATE_SAFE &&
collation == inner_cxt.collation)
state = FDW_COLLATE_SAFE;
else if (collation == DEFAULT_COLLATION_OID)
state = FDW_COLLATE_NONE;
else
state = FDW_COLLATE_UNSAFE;
}
break;
case T_DistinctExpr:
{
/* IS DISTINCT FROM */
elog(DEBUG2, "sqlite_fdw : %s T_DistinctExpr", __func__);
return false;
}
default:
{
elog(DEBUG1, "sqlite_fdw : %s other", __func__);
/*
* If it's anything else, assume it's unsafe. This list can be
* expanded later, but don't forget to add deparse support below.
*/
return false;
}
}
/*
* If result type of given expression is not built-in or PostGIS, it can't be sent to
* remote because it might have incompatible semantics on remote side.
*/
if (check_type)
{
Oid typeOid = exprType(node);
if (!(sqlite_is_builtin(typeOid) || listed_datatype_oid(typeOid, -1, postGisSQLiteCompatibleTypes)))
return false;
}
/*
* Now, merge my collation information into my parent's state.
*/
if (state > outer_cxt->state)
{
/* Override previous parent state */
outer_cxt->collation = collation;
outer_cxt->state = state;
}
else if (state == outer_cxt->state)
{
/* Merge, or detect error if there's a collation conflict */
switch (state)
{
case FDW_COLLATE_NONE:
/* Nothing + nothing is still nothing */
break;
case FDW_COLLATE_SAFE:
if (collation != outer_cxt->collation)
{
/*
* Non-default collation always beats default.
*/
if (outer_cxt->collation == DEFAULT_COLLATION_OID)
{
/* Override previous parent state */
outer_cxt->collation = collation;
}
else if (collation != DEFAULT_COLLATION_OID)
{
/*
* Conflict; show state as indeterminate. We don't
* want to "return false" right away, since parent
* node might not care about collation.
*/
outer_cxt->state = FDW_COLLATE_UNSAFE;
}
}
break;
case FDW_COLLATE_UNSAFE:
/* We're still conflicted ... */
break;
}
}
/* It looks OK */
elog(DEBUG2, "sqlite_fdw : %s, pushed down", __func__);
return true;
}
/*
* Build the targetlist for given relation to be deparsed as SELECT clause.
*
* The output targetlist contains the columns that need to be fetched from the
* foreign server for the given relation. If foreignrel is an upper relation,
* then the output targetlist can also contains expressions to be evaluated on
* foreign server.
*/
List *
sqlite_build_tlist_to_deparse(RelOptInfo *foreignrel)
{
List *tlist = NIL;
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) foreignrel->fdw_private;
ListCell *lc;
/*
* For an upper relation, we have already built the target list while
* checking shippability, so just return that.
*/
if (IS_UPPER_REL(foreignrel))
return fpinfo->grouped_tlist;
/*
* We require columns specified in foreignrel->reltarget->exprs and those
* required for evaluating the local conditions.
*/
tlist = add_to_flat_tlist(tlist,
pull_var_clause((Node *) foreignrel->reltarget->exprs,
PVC_RECURSE_PLACEHOLDERS));
foreach(lc, fpinfo->local_conds)
{
RestrictInfo *rinfo = lfirst_node(RestrictInfo, lc);
tlist = add_to_flat_tlist(tlist,
pull_var_clause((Node *) rinfo->clause,
PVC_RECURSE_PLACEHOLDERS));
}
return tlist;
}
/*
* Deparse SELECT statement for given relation into buf.
*
* tlist contains the list of desired columns to be fetched from foreign server.
* For a base relation fpinfo->attrs_used is used to construct SELECT clause,
* hence the tlist is ignored for a base relation.
*
* remote_conds is the list of conditions to be deparsed into the WHERE clause
* (or, in the case of upper relations, into the HAVING clause).
*
* If params_list is not NULL, it receives a list of Params and other-relation
* Vars used in the clauses; these values must be transmitted to the remote
* server as parameter values.
*
* If params_list is NULL, we're generating the query for EXPLAIN purposes,
* so Params and other-relation Vars should be replaced by dummy values.
*
* pathkeys is the list of pathkeys to order the result by.
*
* List of columns selected is returned in retrieved_attrs.
*/
void
sqlite_deparse_select_stmt_for_rel(StringInfo buf, PlannerInfo *root, RelOptInfo *rel,
List *tlist, List *remote_conds, List *pathkeys,
bool has_final_sort, bool has_limit, bool is_subquery,
List **retrieved_attrs,
List **params_list)
{
deparse_expr_cxt context;
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) rel->fdw_private;
List *quals;
/*
* We handle relations for foreign tables, joins between those and upper
* relations.
*/
Assert(IS_JOIN_REL(rel) ||
IS_SIMPLE_REL(rel) ||
IS_OTHER_REL(rel) ||
IS_UPPER_REL(rel));
/* Fill portions of context common to upper, join and base relation */
context.buf = buf;
context.root = root;
context.foreignrel = rel;
context.scanrel = IS_UPPER_REL(rel) ?
fpinfo->outerrel : rel;
context.params_list = params_list;
/* Construct SELECT clause */
sqlite_deparse_select(tlist, is_subquery, retrieved_attrs, &context);
/*
* For upper relations, the WHERE clause is built from the remote
* conditions of the underlying scan relation; otherwise, we can use the
* supplied list of remote conditions directly.
*/
if (IS_UPPER_REL(rel))
{
SqliteFdwRelationInfo *ofpinfo;
ofpinfo = (SqliteFdwRelationInfo *) fpinfo->outerrel->fdw_private;
quals = ofpinfo->remote_conds;
}
else
quals = remote_conds;
/* Construct FROM and WHERE clauses */
sqlite_deparse_from_expr(quals, &context);
if (IS_UPPER_REL(rel))
{
/* Append GROUP BY clause */
sqlite_append_group_by_clause(tlist, &context);
/* Append HAVING clause */
if (remote_conds)
{
appendStringInfo(buf, " HAVING ");
sqlite_append_conditions(remote_conds, &context);
}
}
/* Add ORDER BY clause if we found any useful pathkeys */
if (pathkeys)
sqlite_append_order_by_clause(pathkeys, has_final_sort, &context);
/* Add LIMIT clause if necessary */
if (has_limit)
sqlite_append_limit_clause(&context);
}
/*
* Deparese SELECT statment
*/
static void
sqlite_deparse_select(List *tlist, bool is_subquery, List **retrieved_attrs, deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
PlannerInfo *root = context->root;
RelOptInfo *foreignrel = context->foreignrel;
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) foreignrel->fdw_private;
/*
* Construct SELECT list
*/
appendStringInfoString(buf, "SELECT ");
if (is_subquery)
{
/*
* For a relation that is deparsed as a subquery, emit expressions
* specified in the relation's reltarget. Note that since this is for
* the subquery, no need to care about *retrieved_attrs.
*/
sqlite_deparse_subquery_target_list(context);
}
else if (IS_JOIN_REL(foreignrel) ||
fpinfo->is_tlist_func_pushdown == true ||
IS_UPPER_REL(foreignrel))
{
/*
* For a join or upper relation the input tlist gives the list of
* columns required to be fetched from the foreign server.
*/
sqlite_deparse_explicit_target_list(tlist, retrieved_attrs, context);
}
else
{
/*
* For a base relation fpinfo->attrs_used gives the list of columns
* required to be fetched from the foreign server.
*/
RangeTblEntry *rte = planner_rt_fetch(foreignrel->relid, root);
/*
* Core code already has some lock on each rel being planned, so we
* can use NoLock here.
*/
Relation rel = table_open(rte->relid, NoLock);
sqlite_deparse_target_list(buf, root, foreignrel->relid, rel, fpinfo->attrs_used, false, retrieved_attrs, false, false);
table_close(rel, NoLock);
}
}
/*
* Construct a FROM clause and, if needed, a WHERE clause, and append those to
* "buf".
*
* quals is the list of clauses to be included in the WHERE clause.
*/
static void
sqlite_deparse_from_expr(List *quals, deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
RelOptInfo *scanrel = context->scanrel;
#if PG_VERSION_NUM >= 170000
List *additional_conds = NIL;
#endif
/* For upper relations, scanrel must be either a joinrel or a baserel */
Assert(!IS_UPPER_REL(context->foreignrel) ||
IS_JOIN_REL(scanrel) ||
IS_SIMPLE_REL(scanrel));
/* Construct FROM clause */
appendStringInfoString(buf, " FROM ");
sqlite_deparse_from_expr_for_rel(buf, context->root, scanrel,
(bms_num_members(scanrel->relids) == BMS_MULTIPLE),
(Index) 0, NULL,
#if PG_VERSION_NUM >= 170000
&additional_conds,
#endif
context->params_list);
#if PG_VERSION_NUM >= 170000
sqlite_append_where_clause(quals, additional_conds, context);
if (additional_conds != NIL)
list_free_deep(additional_conds);
#else
/* Construct WHERE clause */
if (quals != NIL)
{
appendStringInfo(buf, " WHERE ");
sqlite_append_conditions(quals, context);
}
#endif
}
/*
* Deparse conditions from the provided list and append them to buf.
*
* The conditions in the list are assumed to be ANDed. This function is used to
* deparse WHERE clauses, JOIN .. ON clauses and HAVING clauses.
*/
static void
sqlite_append_conditions(List *exprs, deparse_expr_cxt *context)
{
int nestlevel;
ListCell *lc;
bool is_first = true;
StringInfo buf = context->buf;
/* Make sure any constants in the exprs are printed portably */
nestlevel = sqlite_set_transmission_modes();
foreach(lc, exprs)
{
Expr *expr = (Expr *) lfirst(lc);
/* Extract clause from RestrictInfo, if required */
if (IsA(expr, RestrictInfo))
expr = ((RestrictInfo *) expr)->clause;
/* Connect expressions with "AND" and parenthesize each condition. */
if (!is_first)
appendStringInfoString(buf, " AND ");
appendStringInfoChar(buf, '(');
sqlite_deparse_expr(expr, context);
appendStringInfoChar(buf, ')');
is_first = false;
}
sqlite_reset_transmission_modes(nestlevel);
}
/* Output join name for given join type */
const char *
sqlite_get_jointype_name(JoinType jointype)
{
switch (jointype)
{
case JOIN_INNER:
return "INNER";
case JOIN_LEFT:
return "LEFT";
case JOIN_RIGHT:
return "RIGHT";
case JOIN_FULL:
return "FULL";
#if PG_VERSION_NUM >= 170000
case JOIN_SEMI:
return "SEMI";
#endif
default:
/* Shouldn't come here, but protect from buggy code. */
elog(ERROR, "unsupported join type %d", jointype);
}
/* Keep compiler happy */
return NULL;
}
/*
* Deparse given targetlist and append it to context->buf.
*
* tlist is list of TargetEntry's which in turn contain Var nodes.
*
* retrieved_attrs is the list of continuously increasing integers starting
* from 1. It has same number of entries as tlist.
*/
static void
sqlite_deparse_explicit_target_list(List *tlist, List **retrieved_attrs,
deparse_expr_cxt *context)
{
ListCell *lc;
StringInfo buf = context->buf;
int i = 0;
*retrieved_attrs = NIL;
foreach(lc, tlist)
{
TargetEntry *tle = lfirst_node(TargetEntry, lc);
if (i > 0)
appendStringInfoString(buf, ", ");
sqlite_deparse_expr((Expr *) tle->expr, context);
*retrieved_attrs = lappend_int(*retrieved_attrs, i + 1);
i++;
}
if (i == 0)
appendStringInfoString(buf, "NULL");
}
/*
* Emit expressions specified in the given relation's reltarget.
*
* This is used for deparsing the given relation as a subquery.
*/
static void
sqlite_deparse_subquery_target_list(deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
RelOptInfo *foreignrel = context->foreignrel;
bool first;
ListCell *lc;
int col = 1;
/* Should only be called in these cases. */
Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
first = true;
foreach(lc, foreignrel->reltarget->exprs)
{
Node *node = (Node *) lfirst(lc);
if (!first)
appendStringInfoString(buf, ", ");
first = false;
sqlite_deparse_expr((Expr *) node, context);
appendStringInfo(buf, " AS %s%d", SUBQUERY_COL_ALIAS_PREFIX, col);
col++;
}
/* Don't generate bad syntax if no expressions */
if (first)
appendStringInfoString(buf, "NULL");
}
/*
* Construct FROM clause for given relation
*
* The function constructs ... JOIN ... ON ... for join relation. For a base
* relation it just returns schema-qualified tablename, with the appropriate
* alias if so requested.
*
* 'ignore_rel' is either zero or the RT index of a target relation. In the
* latter case the function constructs FROM clause of UPDATE or USING clause
* of DELETE; it deparses the join relation as if the relation never contained
* the target relation, and creates a List of conditions to be deparsed into
* the top-level WHERE clause, which is returned to *ignore_conds.
*
* 'additional_conds' is a pointer to a list of strings to be appended to
* the WHERE clause, coming from lower-level SEMI-JOINs.
*/
static void
sqlite_deparse_from_expr_for_rel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
bool use_alias, Index ignore_rel, List **ignore_conds,
#if PG_VERSION_NUM >= 170000
List **additional_conds,
#endif
List **params_list)
{
if (IS_JOIN_REL(foreignrel))
{
StringInfoData join_sql_o;
StringInfoData join_sql_i;
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) foreignrel->fdw_private;
RelOptInfo *outerrel = fpinfo->outerrel;
RelOptInfo *innerrel = fpinfo->innerrel;
bool outerrel_is_target = false;
bool innerrel_is_target = false;
#if PG_VERSION_NUM >= 170000
List *additional_conds_i = NIL;
List *additional_conds_o = NIL;
#endif
if (ignore_rel > 0 && bms_is_member(ignore_rel, foreignrel->relids))
{
/*
* If this is an inner join, add joinclauses to *ignore_conds and
* set it to empty so that those can be deparsed into the WHERE
* clause. Note that since the target relation can never be
* within the nullable side of an outer join, those could safely
* be pulled up into the WHERE clause (see foreign_join_ok()).
* Note also that since the target relation is only inner-joined
* to any other relation in the query, all conditions in the join
* tree mentioning the target relation could be deparsed into the
* WHERE clause by doing this recursively.
*/
if (fpinfo->jointype == JOIN_INNER)
{
*ignore_conds = list_concat(*ignore_conds,
fpinfo->joinclauses);
fpinfo->joinclauses = NIL;
}
/*
* Check if either of the input relations is the target relation.
*/
if (outerrel->relid == ignore_rel)
outerrel_is_target = true;
else if (innerrel->relid == ignore_rel)
innerrel_is_target = true;
}
/* Deparse outer relation if not the target relation. */
if (!outerrel_is_target)
{
initStringInfo(&join_sql_o);
sqlite_deparse_range_tbl_ref(&join_sql_o, root, outerrel,
fpinfo->make_outerrel_subquery,
ignore_rel, ignore_conds,
#if PG_VERSION_NUM >= 170000
&additional_conds_o,
#endif
params_list);
/*
* If inner relation is the target relation, skip deparsing it.
* Note that since the join of the target relation with any other
* relation in the query is an inner join and can never be within
* the nullable side of an outer join, the join could be
* interchanged with higher-level joins (cf. identity 1 on outer
* join reordering shown in src/backend/optimizer/README), which
* means it's safe to skip the target-relation deparsing here.
*/
if (innerrel_is_target)
{
Assert(fpinfo->jointype == JOIN_INNER);
Assert(fpinfo->joinclauses == NIL);
appendBinaryStringInfo(buf, join_sql_o.data, join_sql_o.len);
#if PG_VERSION_NUM >= 170000
/* Pass EXISTS conditions to upper level */
if (additional_conds_o != NIL)
{
Assert(*additional_conds == NIL);
*additional_conds = additional_conds_o;
}
#endif
return;
}
}
/* Deparse inner relation if not the target relation. */
if (!innerrel_is_target)
{
initStringInfo(&join_sql_i);
sqlite_deparse_range_tbl_ref(&join_sql_i, root, innerrel,
fpinfo->make_innerrel_subquery,
ignore_rel, ignore_conds,
#if PG_VERSION_NUM >= 170000
&additional_conds_i,
#endif
params_list);
#if PG_VERSION_NUM >= 170000
/*
* SEMI-JOIN is deparsed as the EXISTS subquery. It references
* outer and inner relations, so it should be evaluated as the
* condition in the upper-level WHERE clause. We deparse the
* condition and pass it to upper level callers as an
* additional_conds list. Upper level callers are responsible for
* inserting conditions from the list where appropriate.
*/
if (fpinfo->jointype == JOIN_SEMI)
{
deparse_expr_cxt context;
StringInfoData str;
/* Construct deparsed condition from this SEMI-JOIN */
initStringInfo(&str);
appendStringInfo(&str, "EXISTS (SELECT NULL FROM %s",
join_sql_i.data);
context.buf = &str;
context.foreignrel = foreignrel;
context.scanrel = foreignrel;
context.root = root;
context.params_list = params_list;
/*
* Append SEMI-JOIN clauses and EXISTS conditions from lower
* levels to the current EXISTS subquery
*/
sqlite_append_where_clause(fpinfo->joinclauses, additional_conds_i, &context);
/*
* EXISTS conditions, coming from lower join levels, have just
* been processed.
*/
if (additional_conds_i != NIL)
{
list_free_deep(additional_conds_i);
additional_conds_i = NIL;
}
/* Close parentheses for EXISTS subquery */
appendStringInfoChar(&str, ')');
*additional_conds = lappend(*additional_conds, str.data);
}
#endif
/*
* If outer relation is the target relation, skip deparsing it.
* See the above note about safety.
*/
if (outerrel_is_target)
{
Assert(fpinfo->jointype == JOIN_INNER);
Assert(fpinfo->joinclauses == NIL);
appendBinaryStringInfo(buf, join_sql_i.data, join_sql_i.len);
#if PG_VERSION_NUM >= 170000
/* Pass EXISTS conditions to the upper call */
if (additional_conds_i != NIL)
{
Assert(*additional_conds == NIL);
*additional_conds = additional_conds_i;
}
#endif
return;
}
}
/* Neither of the relations is the target relation. */
Assert(!outerrel_is_target && !innerrel_is_target);
#if PG_VERSION_NUM >= 170000
/*
* For semijoin FROM clause is deparsed as an outer relation. An inner
* relation and join clauses are converted to EXISTS condition and
* passed to the upper level.
*/
if (fpinfo->jointype == JOIN_SEMI)
{
appendBinaryStringInfo(buf, join_sql_o.data, join_sql_o.len);
}
else
{
#endif
/*
* For a join relation FROM clause, entry is deparsed as
*
* ((outer relation) <join type> (inner relation) ON
* (joinclauses))
*/
appendStringInfo(buf, "(%s %s JOIN %s ON ", join_sql_o.data,
sqlite_get_jointype_name(fpinfo->jointype), join_sql_i.data);
/* Append join clause; (TRUE) if no join clause */
if (fpinfo->joinclauses)
{
deparse_expr_cxt context;
context.buf = buf;
context.foreignrel = foreignrel;
context.scanrel = foreignrel;
context.root = root;
context.params_list = params_list;
appendStringInfo(buf, "(");
sqlite_append_conditions(fpinfo->joinclauses, &context);
appendStringInfo(buf, ")");
}
else
appendStringInfoString(buf, "(TRUE)");
/* End the FROM clause entry. */
appendStringInfo(buf, ")");
#if PG_VERSION_NUM >= 170000
}
/*
* Construct additional_conds to be passed to the upper caller from
* current level additional_conds and additional_conds, coming from
* inner and outer rels.
*/
if (additional_conds_o != NIL)
{
*additional_conds = list_concat(*additional_conds,
additional_conds_o);
list_free(additional_conds_o);
}
if (additional_conds_i != NIL)
{
*additional_conds = list_concat(*additional_conds,
additional_conds_i);
list_free(additional_conds_i);
}
#endif
}
else
{
RangeTblEntry *rte = planner_rt_fetch(foreignrel->relid, root);
/*
* Core code already has some lock on each rel being planned, so we
* can use NoLock here.
*/
Relation rel = table_open(rte->relid, NoLock);
sqlite_deparse_relation(buf, rel);
/*
* Add a unique alias to avoid any conflict in relation names due to
* pulled up subqueries in the query being built for a pushed down
* join.
*/
if (use_alias)
appendStringInfo(buf, " %s%d", REL_ALIAS_PREFIX, foreignrel->relid);
table_close(rel, NoLock);
}
}
/*
* Append FROM clause entry for the given relation into buf.
* Conditions from lower-level SEMI-JOINs are appended to additional_conds
* and should be added to upper level WHERE clause.
*/
static void
sqlite_deparse_range_tbl_ref(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
bool make_subquery, Index ignore_rel, List **ignore_conds,
#if PG_VERSION_NUM >= 170000
List **additional_conds,
#endif
List **params_list)
{
SqliteFdwRelationInfo *fpinfo = (SqliteFdwRelationInfo *) foreignrel->fdw_private;
/* Should only be called in these cases. */
Assert(IS_SIMPLE_REL(foreignrel) || IS_JOIN_REL(foreignrel));
Assert(fpinfo->local_conds == NIL);
/* If make_subquery is true, deparse the relation as a subquery. */
if (make_subquery)
{
List *retrieved_attrs;
/*
* The given relation shouldn't contain the target relation, because
* this should only happen for input relations for a full join, and
* such relations can never contain an UPDATE/DELETE target.
*/
Assert(ignore_rel == 0 ||
!bms_is_member(ignore_rel, foreignrel->relids));
/* Deparse the subquery representing the relation. */
appendStringInfoChar(buf, '(');
sqlite_deparse_select_stmt_for_rel(buf, root, foreignrel, NIL,
fpinfo->remote_conds, NIL,
false, false, true,
&retrieved_attrs, params_list);
appendStringInfoChar(buf, ')');
/* Append the relation alias. */
appendStringInfo(buf, " %s%d", SUBQUERY_REL_ALIAS_PREFIX,
fpinfo->relation_index);
}
else
sqlite_deparse_from_expr_for_rel(buf, root, foreignrel, true, ignore_rel,
ignore_conds,
#if PG_VERSION_NUM >= 170000
additional_conds,
#endif
params_list);
}
/*
* deparse remote INSERT statement
*
* The statement text is appended to buf, and we also create an integer List
* of the columns being retrieved by RETURNING (if any), which is returned
* to *retrieved_attrs.
*/
void
sqlite_deparse_insert(StringInfo buf, PlannerInfo *root,
Index rtindex, Relation rel,
List *targetAttrs, bool doNothing,
int *values_end_len)
{
#if PG_VERSION_NUM >= 140000
TupleDesc tupdesc = RelationGetDescr(rel);
bool all_columns_generated = true;
#endif
AttrNumber pindex;
bool first;
ListCell *lc;
appendStringInfo(buf, "INSERT %sINTO ", doNothing ? "OR IGNORE " : "");
sqlite_deparse_relation(buf, rel);
#if PG_VERSION_NUM >= 140000
/*
* Check all columns in table that they are all generated column or not.
* If true, we will skip all columns and just add 'DEFAULT VALUES'. If
* not, we still push down other columns which are not generated column.
*/
if (targetAttrs)
{
foreach(lc, targetAttrs)
{
int attnum = linitial_int(targetAttrs);
Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
if (!attr->attgenerated)
{
all_columns_generated = false;
break;
}
}
}
#endif
#if (PG_VERSION_NUM >= 140000)
if (targetAttrs && !all_columns_generated)
#else
if (targetAttrs)
#endif
{
appendStringInfoChar(buf, '(');
first = true;
foreach(lc, targetAttrs)
{
int attnum = lfirst_int(lc);
#if PG_VERSION_NUM >= 140000
Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
if (!attr->attgenerated)
{
#endif
if (!first)
appendStringInfoString(buf, ", ");
first = false;
sqlite_deparse_column_ref(buf, rtindex, attnum, root, false, true);
#if PG_VERSION_NUM >= 140000
}
#endif
}
appendStringInfoString(buf, ") VALUES (");
pindex = 1;
first = true;
foreach(lc, targetAttrs)
{
#if PG_VERSION_NUM >= 140000
int attnum = lfirst_int(lc);
Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
if (!attr->attgenerated)
{
#endif
if (!first)
appendStringInfoString(buf, ", ");
first = false;
appendStringInfo(buf, "?");
pindex++;
#if PG_VERSION_NUM >= 140000
}
#endif
}
appendStringInfoChar(buf, ')');
}
else
appendStringInfoString(buf, " DEFAULT VALUES");
*values_end_len = buf->len;
}
#if PG_VERSION_NUM >= 140000
/*
* rebuild remote INSERT statement
*
* Provided a number of rows in a batch, builds INSERT statement with the
* right number of parameters.
*/
void
sqlite_rebuild_insert(StringInfo buf, Relation rel, char *orig_query,
List *target_attrs, int values_end_len, int num_params,
int num_rows)
{
TupleDesc tupdesc = RelationGetDescr(rel);
int i;
bool first;
ListCell *lc;
/* Make sure the values_end_len is sensible */
Assert((values_end_len > 0) && (values_end_len <= strlen(orig_query)));
/* Copy up to the end of the first record from the original query */
appendBinaryStringInfo(buf, orig_query, values_end_len);
/*
* Add records to VALUES clause (we already have parameters for the first
* row, so start at the right offset).
*/
for (i = 0; i < num_rows; i++)
{
appendStringInfoString(buf, ", (");
first = true;
foreach(lc, target_attrs)
{
int attnum = lfirst_int(lc);
Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
if (!attr->attgenerated)
{
if (!first)
appendStringInfoString(buf, ", ");
first = false;
appendStringInfo(buf, "?");
}
}
appendStringInfoChar(buf, ')');
}
/* Copy stuff after VALUES clause from the original query */
appendStringInfoString(buf, orig_query + values_end_len);
}
#endif
void
sqlite_deparse_analyze(StringInfo sql, char *dbname, char *relname)
{
appendStringInfo(sql, "SELECT");
appendStringInfo(sql, " round(((data_length + index_length)), 2)");
appendStringInfo(sql, " FROM information_schema.TABLES");
appendStringInfo(sql, " WHERE table_schema = '%s' AND table_name = '%s'", dbname, relname);
}
/*
* Emit a target list that retrieves the columns specified in attrs_used.
* This is used for both SELECT and RETURNING targetlists.
*/
static void
sqlite_deparse_target_list(StringInfo buf,
PlannerInfo *root,
Index rtindex,
Relation rel,
Bitmapset *attrs_used,
bool qualify_col,
List **retrieved_attrs,
bool is_concat,
bool check_null)
{
TupleDesc tupdesc = RelationGetDescr(rel);
bool have_wholerow;
bool first;
int i;
/* If there's a whole-row reference, we'll need all the columns. */
have_wholerow = bms_is_member(0 - FirstLowInvalidHeapAttributeNumber,
attrs_used);
first = true;
*retrieved_attrs = NIL;
for (i = 1; i <= tupdesc->natts; i++)
{
Form_pg_attribute attr = TupleDescAttr(tupdesc, i - 1);
/* Ignore dropped attributes. */
if (attr->attisdropped)
continue;
if (have_wholerow ||
bms_is_member(i - FirstLowInvalidHeapAttributeNumber,
attrs_used))
{
if (!first)
{
if (is_concat)
appendStringInfoString(buf, ", '') || \",\" || COALESCE(");
else if (check_null)
appendStringInfoString(buf, "OR ( ");
else
appendStringInfoString(buf, ", ");
}
else if (is_concat)
appendStringInfoString(buf, "COALESCE(");
else if (check_null)
appendStringInfoString(buf, "( ");
first = false;
sqlite_deparse_column_ref(buf, rtindex, i, root, qualify_col, false);
if (check_null)
appendStringInfoString(buf, " IS NOT NULL) ");
*retrieved_attrs = lappend_int(*retrieved_attrs, i);
}
}
/* Don't generate bad syntax if no undropped columns */
if (first)
appendStringInfoString(buf, "NULL");
else if (is_concat)
appendStringInfoString(buf, ", '')");
}
#if PG_VERSION_NUM >= 170000
/*
* Append WHERE clause, containing conditions from exprs and additional_conds,
* to context->buf.
*/
void
sqlite_append_where_clause(List *exprs, List *additional_conds, deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
bool need_and = false;
ListCell *lc;
if (exprs != NIL || additional_conds != NIL)
appendStringInfoString(buf, " WHERE ");
/*
* If there are some filters, append them.
*/
if (exprs != NIL)
{
sqlite_append_conditions(exprs, context);
need_and = true;
}
/*
* If there are some EXISTS conditions, coming from SEMI-JOINS, append
* them.
*/
foreach(lc, additional_conds)
{
if (need_and)
appendStringInfoString(buf, " AND ");
appendStringInfoString(buf, (char *) lfirst(lc));
need_and = true;
}
}
#endif
#if PG_VERSION_NUM >= 140000
/*
* TRUNCATE in SQLite is supported by use DELETE FROM without WHERE condition.
*/
void
sqlite_deparse_truncate(StringInfo buf,
List *rels)
{
ListCell *cell;
Relation rel;
appendStringInfoString(buf, "PRAGMA foreign_keys = ON;");
foreach(cell, rels)
{
appendStringInfoString(buf, "DELETE FROM ");
rel = lfirst(cell);
sqlite_deparse_relation(buf, rel);
appendStringInfoChar(buf, ';');
}
}
#endif
/*
* Construct name to use for given column, and emit it into buf.
* If it has a column_name FDW option, use that instead of attribute name.
*/
static void
sqlite_deparse_column_ref(StringInfo buf, int varno, int varattno, PlannerInfo *root, bool qualify_col, bool dml_context)
{
RangeTblEntry *rte;
/* Get RangeTblEntry from array in PlannerInfo. */
rte = planner_rt_fetch(varno, root);
if (varattno == 0)
{
/* Whole row reference */
Relation rel;
Bitmapset *attrs_used;
/* Required only to be passed down to deparseTargetList(). */
List *retrieved_attrs;
/*
* The lock on the relation will be held by upper callers, so it's
* fine to open it with no lock here.
*/
rel = table_open(rte->relid, NoLock);
/*
* The local name of the foreign table can not be recognized by the
* foreign server and the table it references on foreign server might
* have different column ordering or different columns than those
* declared locally. Hence we have to deparse whole-row reference as
* ROW(columns referenced locally). Construct this by deparsing a
* "whole row" attribute.
*/
attrs_used = bms_add_member(NULL,
0 - FirstLowInvalidHeapAttributeNumber);
/*
* In case the whole-row reference is under an outer join then it has
* to go NULL whenever the rest of the row goes NULL. Deparsing a join
* query would always involve multiple relations, thus qualify_col
* would be true.
*/
appendStringInfoString(buf, "CASE WHEN ");
sqlite_deparse_target_list(buf, root, varno, rel, attrs_used, qualify_col,
&retrieved_attrs, false, true);
appendStringInfoString(buf, "THEN ");
appendStringInfoString(buf, "(\"(\" || ");
sqlite_deparse_target_list(buf, root, varno, rel, attrs_used, qualify_col,
&retrieved_attrs, true, false);
appendStringInfoString(buf, "|| \")\")");
appendStringInfoString(buf, " END");
table_close(rel, NoLock);
bms_free(attrs_used);
}
else
{
char *colname = NULL;
List *options;
ListCell *lc;
Oid pg_atttyp = InvalidOid;
bool no_unification = false;
char *coltype = NULL;
int colaff = SQLITE_NULL;
/* varno must not be any of OUTER_VAR, INNER_VAR and INDEX_VAR. */
Assert(!IS_SPECIAL_VARNO(varno));
/*
* If it's a column of a foreign table, and it has the column_name FDW
* option, use that value.
*/
options = GetForeignColumnOptions(rte->relid, varattno);
foreach(lc, options)
{
DefElem *def = (DefElem *) lfirst(lc);
if (strcmp(def->defname, "column_name") == 0)
{
colname = defGetString(def);
elog(DEBUG1, "column name = %s\n", colname);
break;
}
if (strcmp(def->defname, "column_type") == 0)
{
coltype = defGetString(def);
elog(DEBUG4, "column type = %s", coltype);
colaff = sqlite_affinity_code(coltype);
}
}
/*
* If it's a column of a regular table or it doesn't have column_name
* FDW option, use attribute name.
*/
if (colname == NULL)
#if (PG_VERSION_NUM >= 110000)
colname = get_attname(rte->relid, varattno, false);
#else
colname = get_attname(rte->relid, varattno);
#endif
pg_atttyp = get_atttype(rte->relid, varattno);
/*
* PostgreSQL data types with possible mixed affinity SQLite base we should
* normalize to preferred form in SQLite before transfer to PostgreSQL.
* Recommended form for normalisation is someone from 1<->1 with PostgreSQL
* internal storage, hence usually this will not original text data.
*/
if (!dml_context)
{
switch (pg_atttyp)
{
/* some polular usual data types without normalization first */
case INT4OID:
case TEXTOID:
case VARCHAROID:
case BYTEAOID:
case INT8OID:
case BPCHAROID:
case INT2OID:
case TIMEOID:
case TIMESTAMPOID:
case TIMESTAMPTZOID:
case DATEOID:
case NAMEOID:
case VARBITOID:
case BITOID:
case CHAROID:
{
no_unification = true;
break;
}
case FLOAT8OID:
case FLOAT4OID:
case NUMERICOID:
{
elog(DEBUG2, "floatN unification for \"%s\"", colname);
appendStringInfoString(buf, "sqlite_fdw_float(");
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
appendStringInfoString(buf, ")");
break;
}
case BOOLOID:
{
elog(DEBUG2, "boolean unification for \"%s\"", colname);
appendStringInfoString(buf, "sqlite_fdw_bool(");
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
appendStringInfoString(buf, ")");
break;
}
case UUIDOID:
{
elog(DEBUG2, "UUID unification for \"%s\"", colname);
appendStringInfoString(buf, "sqlite_fdw_uuid_blob(");
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
appendStringInfoString(buf, ")");
break;
}
case MACADDROID:
case MACADDR8OID:
{
int mac_len = (pg_atttyp == MACADDROID) ? MACADDR_LEN : MACADDR8_LEN;
elog(DEBUG2, "MAC%d address unification for \"%s\"", mac_len, colname);
appendStringInfoString(buf, "sqlite_fdw_macaddr_int(");
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
appendStringInfo(buf, ", %d)", mac_len);
break;
}
case JSONOID:
{
if (colaff != SQLITE_TEXT)
{
elog(DEBUG2, "json unification for \"%s\"", colname);
appendStringInfoString(buf, "json(");
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
appendStringInfoString(buf, ")");
}
else
{
elog(DEBUG2, "json text affinity only for \"%s\"", colname);
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
}
break;
}
case JSONBOID: /* jsonb in SQLite is no the same as in PosrtgreSQL, use text transport */
{
elog(DEBUG2, "sqlite_fdw : json unification for \"%s\"", colname);
appendStringInfoString(buf, "json(");
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
appendStringInfoString(buf, ")");
break;
}
default:
{
no_unification = true;
#ifndef SQLITE_FDW_GIS_ENABLE
if (listed_datatype_oid(pg_atttyp, -1, postGisSQLiteCompatibleTypes))
{
int32 typmod = -1;
Oid typid = getBaseTypeAndTypmod(pg_atttyp, &typmod);
char *pg_dataTypeName = TypeNameToString(makeTypeNameFromOid(pg_atttyp, -1));
if (typid != BYTEAOID)
{
ereport(ERROR, (errcode(ERRCODE_FDW_INVALID_DATA_TYPE),
errmsg("This PostGIS data type is supported by SpatiaLite, but FDW compiled without GIS data support"),
errhint("Data type: \"%s\"", pg_dataTypeName)));
}
/* else no unification for normal column */
}
else
#endif
if (listed_datatype_oid(pg_atttyp, -1, postGisSpecificTypes))
{
char *pg_dataTypeName = TypeNameToString(makeTypeNameFromOid(pg_atttyp, -1));
ereport(ERROR, (errcode(ERRCODE_FDW_INVALID_DATA_TYPE),
errmsg("PostGIS specific value is not deparsable because of no similar SpatiaLite conception"),
errhint("Data type: \"%s\"", pg_dataTypeName)));
}
}
}
}
else
no_unification = true;
if (no_unification)
{
elog(DEBUG3, "sqlite_fdw : %s, varattrno != 0, not unificated column \"%s\"", __func__, colname);
if (qualify_col)
ADD_REL_QUALIFIER(buf, varno);
appendStringInfoString(buf, sqlite_quote_identifier(colname, '`'));
}
}
}
/*
* Get column option with optionname for a variable attribute in deparsing context
*/
static char *
sqlite_deparse_column_option(int varno, int varattno, PlannerInfo *root, char *optionname)
{
RangeTblEntry *rte;
char *coloptionvalue = NULL;
List *options;
ListCell *lc;
/* varno must not be any of OUTER_VAR, INNER_VAR and INDEX_VAR. */
Assert(!IS_SPECIAL_VARNO(varno));
/* Get RangeTblEntry from array in PlannerInfo. */
rte = planner_rt_fetch(varno, root);
/*
* If it's a column of a foreign table, and it has the optionname value named FDW
* option, use that value.
*/
options = GetForeignColumnOptions(rte->relid, varattno);
foreach(lc, options)
{
DefElem *def = (DefElem *) lfirst(lc);
if (strcmp(def->defname, optionname) == 0)
{
coloptionvalue = defGetString(def);
break;
}
}
return coloptionvalue;
}
/*
* Convert a text value from PostgreSQL database with an encoding to SQLite value which is always UTF8
*/
static const char *
pg_text_value_to_sqlite_text(const char * pg_text_value)
{
int pg_database_encoding = GetDatabaseEncoding(); /* very fast call, see PostgreSQL mbutils.c */
return (pg_database_encoding == PG_UTF8) ? pg_text_value : (char *) pg_do_encoding_conversion((unsigned char *) pg_text_value, strlen(pg_text_value), pg_database_encoding, PG_UTF8);
}
/*
* Append a SQL string literal representing "val" to buf.
*/
void
sqlite_deparse_string_literal(StringInfo buf, const char *val)
{
const char *sqlite_text_val;
const char *valptr;
sqlite_text_val = pg_text_value_to_sqlite_text(val);
appendStringInfoChar(buf, '\'');
for (valptr = sqlite_text_val; *valptr; valptr++)
{
char ch = *valptr;
if (SQL_STR_DOUBLE(ch, true))
appendStringInfoChar(buf, ch);
appendStringInfoChar(buf, ch);
}
appendStringInfoChar(buf, '\'');
}
/*
* Deparse given expression into context->buf.
*
* This function must support all the same node types that sqlite_foreign_expr_walker
* accepts.
*
* Note: unlike ruleutils.c, we just use a simple hard-wired parenthesization
* scheme: anything more complex than a Var, Const, function call or cast
* should be self-parenthesized.
*/
static void
sqlite_deparse_expr(Expr *node, deparse_expr_cxt *context)
{
if (node == NULL)
return;
switch (nodeTag(node))
{
case T_Var:
sqlite_deparse_var((Var *) node, context);
break;
case T_Const:
sqlite_deparse_const((Const *) node, context, 0);
break;
case T_Param:
sqlite_deparse_param((Param *) node, context);
break;
case T_FuncExpr:
sqlite_deparse_func_expr((FuncExpr *) node, context);
break;
case T_OpExpr:
sqlite_deparse_op_expr((OpExpr *) node, context);
break;
case T_ScalarArrayOpExpr:
sqlite_deparse_scalar_array_op_expr((ScalarArrayOpExpr *) node, context);
break;
case T_RelabelType:
sqlite_deparse_relabel_type((RelabelType *) node, context);
break;
case T_BoolExpr:
sqlite_deparse_bool_expr((BoolExpr *) node, context);
break;
case T_NullTest:
sqlite_deparse_null_test((NullTest *) node, context);
break;
case T_ArrayExpr:
sqlite_deparse_array_expr((ArrayExpr *) node, context);
break;
case T_CaseExpr:
sqlite_deparse_case_expr((CaseExpr *) node, context);
break;
case T_CoalesceExpr:
sqlite_deparse_coalesce_expr((CoalesceExpr *) node, context);
break;
case T_NullIfExpr:
sqlite_deparse_null_if_expr((NullIfExpr *) node, context);
break;
case T_Aggref:
sqlite_deparse_aggref((Aggref *) node, context);
break;
default:
elog(ERROR, "unsupported expression type for deparse: %d",
(int) nodeTag(node));
break;
}
}
/*
* deparse remote UPDATE statement
*
* The statement text is appended to buf, and we also create an integer List
* of the columns being retrieved by RETURNING (if any), which is returned
* to *retrieved_attrs.
*/
void
sqlite_deparse_update(StringInfo buf, PlannerInfo *root,
Index rtindex, Relation rel,
List *targetAttrs, List *attnums)
{
#if PG_VERSION_NUM >= 140000
TupleDesc tupdesc = RelationGetDescr(rel);
#endif
AttrNumber pindex;
bool first;
ListCell *lc;
int i;
appendStringInfoString(buf, "UPDATE ");
sqlite_deparse_relation(buf, rel);
appendStringInfoString(buf, " SET ");
pindex = 2;
first = true;
foreach(lc, targetAttrs)
{
int attnum = lfirst_int(lc);
#if PG_VERSION_NUM >= 140000
Form_pg_attribute attr = TupleDescAttr(tupdesc, attnum - 1);
if (!attr->attgenerated)
{
#endif
if (!first)
appendStringInfoString(buf, ", ");
first = false;
sqlite_deparse_column_ref(buf, rtindex, attnum, root, false, true);
appendStringInfo(buf, " = ?");
pindex++;
#if PG_VERSION_NUM >= 140000
}
#endif
}
i = 0;
foreach(lc, attnums)
{
int attnum = lfirst_int(lc);
appendStringInfo(buf, i == 0 ? " WHERE " : " AND ");
sqlite_deparse_column_ref(buf, rtindex, attnum, root, false, true);
appendStringInfo(buf, "=?");
i++;
}
}
/*
* Preferred SQLite affinity from "column_type" foreign column option
* SQLITE_NULL if no value or no normal value
*/
int
preferred_sqlite_affinity (Oid relid, int varattno)
{
char *coltype = NULL;
List *options;
ListCell *lc;
elog(DEBUG4, "sqlite_fdw : %s ", __func__);
if (varattno == 0)
return SQLITE_NULL;
options = GetForeignColumnOptions(relid, varattno);
foreach(lc, options)
{
DefElem *def = (DefElem *) lfirst(lc);
if (strcmp(def->defname, "column_type") == 0)
{
coltype = defGetString(def);
elog(DEBUG4, "column type = %s", coltype);
break;
}
}
return sqlite_affinity_code(coltype);
}
/*
* deparse remote UPDATE statement
*
* 'buf' is the output buffer to append the statement to 'rtindex' is the RT
* index of the associated target relation 'rel' is the relation descriptor
* for the target relation 'foreignrel' is the RelOptInfo for the target
* relation or the join relation containing all base relations in the query
* 'targetlist' is the tlist of the underlying foreign-scan plan node
* 'targetAttrs' is the target columns of the UPDATE 'remote_conds' is the
* qual clauses that must be evaluated remotely '*params_list' is an output
* list of exprs that will become remote Params '*retrieved_attrs' is an
* output list of integers of columns being retrieved by RETURNING (if any)
*/
void
sqlite_deparse_direct_update_sql(StringInfo buf, PlannerInfo *root,
Index rtindex, Relation rel,
RelOptInfo *foreignrel,
List *targetlist,
List *targetAttrs,
List *remote_conds,
List **params_list,
List **retrieved_attrs)
{
deparse_expr_cxt context;
int nestlevel;
bool first;
ListCell *lc;
ListCell *lc2;
#if PG_VERSION_NUM >= 170000
List *additional_conds = NIL;
#endif
elog(DEBUG3, "sqlite_fdw : %s\n", __func__);
/* Set up context struct for recursion */
context.root = root;
context.foreignrel = foreignrel;
context.scanrel = foreignrel;
context.buf = buf;
context.params_list = params_list;
appendStringInfoString(buf, "UPDATE ");
sqlite_deparse_relation(buf, rel);
if (IS_JOIN_REL(foreignrel))
appendStringInfo(buf, " %s%d", REL_ALIAS_PREFIX, rtindex);
appendStringInfoString(buf, " SET ");
/* Make sure any constants in the exprs are printed portably */
nestlevel = sqlite_set_transmission_modes();
first = true;
forboth(lc, targetlist, lc2, targetAttrs)
{
int attnum = lfirst_int(lc2);
int preferred_affinity = SQLITE_NULL;
TargetEntry *tle;
RangeTblEntry *rte;
bool special_affinity = false;
Oid pg_attyp;
#if (PG_VERSION_NUM >= 140000)
tle = lfirst_node(TargetEntry, lc);
/* update's new-value expressions shouldn't be resjunk */
Assert(!tle->resjunk);
#else
(void) lc;
tle = get_tle_by_resno(targetlist, attnum);
#endif
if (!tle)
elog(ERROR, "attribute number %d not found in UPDATE targetlist",
attnum);
if (!first)
appendStringInfoString(buf, ", ");
first = false;
sqlite_deparse_column_ref(buf, rtindex, attnum, root, false, true);
/* Get RangeTblEntry from array in PlannerInfo. */
rte = planner_rt_fetch(rtindex, root);
pg_attyp = get_atttype(rte->relid, attnum);
preferred_affinity = preferred_sqlite_affinity(rte->relid, attnum);
appendStringInfoString(buf, " = ");
if (pg_attyp == UUIDOID && preferred_affinity == SQLITE3_TEXT)
{
appendStringInfo(buf, "sqlite_fdw_uuid_str(");
special_affinity = true;
}
else if ((pg_attyp == MACADDROID || pg_attyp == MACADDR8OID) && preferred_affinity != SQLITE_INTEGER)
{
if (preferred_affinity == SQLITE3_TEXT)
appendStringInfo(buf, "sqlite_fdw_macaddr_str(");
else if (preferred_affinity == SQLITE_BLOB)
appendStringInfo(buf, "sqlite_fdw_macaddr_blob(");
special_affinity = true;
}
sqlite_deparse_expr((Expr *) tle->expr, &context);
if (preferred_affinity == SQLITE3_TEXT || preferred_affinity == SQLITE_BLOB)
{
if (pg_attyp == MACADDROID)
appendStringInfo(buf, ", %d", MACADDR_LEN);
else if (pg_attyp == MACADDR8OID)
appendStringInfo(buf, ", %d", MACADDR8_LEN);
}
if (special_affinity)
{
elog(DEBUG4, "sqlite_fdw : aff %d\n", preferred_affinity);
appendStringInfoString(buf, ")");
}
}
sqlite_reset_transmission_modes(nestlevel);
if (IS_JOIN_REL(foreignrel))
{
List *ignore_conds = NIL;
appendStringInfo(buf, " FROM ");
sqlite_deparse_from_expr_for_rel(buf, root, foreignrel, true, rtindex,
&ignore_conds,
#if PG_VERSION_NUM >= 170000
&additional_conds,
#endif
params_list);
remote_conds = list_concat(remote_conds, ignore_conds);
}
#if PG_VERSION_NUM >= 170000
sqlite_append_where_clause(remote_conds, additional_conds, &context);
if (additional_conds != NIL)
list_free_deep(additional_conds);
#else
if (remote_conds)
{
appendStringInfoString(buf, " WHERE ");
sqlite_append_conditions(remote_conds, &context);
}
#endif
}
/*
* deparse remote DELETE statement
*
* The statement text is appended to buf, and we also create an integer List
* of the columns being retrieved by RETURNING (if any), which is returned
* to *retrieved_attrs.
*/
void
sqlite_deparse_delete(StringInfo buf, PlannerInfo *root,
Index rtindex, Relation rel,
List *attname)
{
int i = 0;
ListCell *lc;
appendStringInfoString(buf, "DELETE FROM ");
sqlite_deparse_relation(buf, rel);
foreach(lc, attname)
{
int attnum = lfirst_int(lc);
appendStringInfo(buf, i == 0 ? " WHERE " : " AND ");
sqlite_deparse_column_ref(buf, rtindex, attnum, root, false, true);
appendStringInfo(buf, "=?");
i++;
}
}
/*
* deparse remote DELETE statement
*
* 'buf' is the output buffer to append the statement to 'rtindex' is the RT
* index of the associated target relation 'rel' is the relation descriptor
* for the target relation 'foreignrel' is the RelOptInfo for the target
* relation or the join relation containing all base relations in the query
* 'remote_conds' is the qual clauses that must be evaluated remotely
* '*params_list' is an output list of exprs that will become remote Params
* '*retrieved_attrs' is an output list of integers of columns being
* retrieved by RETURNING (if any)
*/
void
sqlite_deparse_direct_delete_sql(StringInfo buf, PlannerInfo *root,
Index rtindex, Relation rel,
RelOptInfo *foreignrel,
List *remote_conds,
List **params_list,
List **retrieved_attrs)
{
deparse_expr_cxt context;
#if PG_VERSION_NUM >= 170000
List *additional_conds = NIL;
#endif
elog(DEBUG1, "sqlite_fdw : %s", __func__);
/* Set up context struct for recursion */
context.root = root;
context.foreignrel = foreignrel;
context.scanrel = foreignrel;
context.buf = buf;
context.params_list = params_list;
appendStringInfoString(buf, "DELETE FROM ");
sqlite_deparse_relation(buf, rel);
if (IS_JOIN_REL(foreignrel))
appendStringInfo(buf, " %s%d", REL_ALIAS_PREFIX, rtindex);
if (IS_JOIN_REL(foreignrel))
{
List *ignore_conds = NIL;
appendStringInfo(buf, " USING ");
sqlite_deparse_from_expr_for_rel(buf, root, foreignrel, true, rtindex,
&ignore_conds,
#if PG_VERSION_NUM >= 170000
&additional_conds,
#endif
params_list);
remote_conds = list_concat(remote_conds, ignore_conds);
}
#if PG_VERSION_NUM >= 170000
sqlite_append_where_clause(remote_conds, additional_conds, &context);
if (additional_conds != NIL)
list_free_deep(additional_conds);
#else
if (remote_conds)
{
appendStringInfoString(buf, " WHERE ");
sqlite_append_conditions(remote_conds, &context);
}
#endif
}
/*
* Deparse given Var node into context->buf.
*
* If the Var belongs to the foreign relation, just print its remote name.
* Otherwise, it's effectively a Param (and will in fact be a Param at
* run time). Handle it the same way we handle plain Params --- see
* deparseParam for comments.
*/
static void
sqlite_deparse_var(Var *node, deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
Relids relids = context->scanrel->relids;
int relno;
int colno;
/* Qualify columns when multiple relations are involved. */
bool qualify_col = (bms_membership(relids) == BMS_MULTIPLE);
/*
* If the Var belongs to the foreign relation that is deparsed as a
* subquery, use the relation and column alias to the Var provided by the
* subquery, instead of the remote name.
*/
if (sqlite_is_subquery_var(node, context->scanrel, &relno, &colno))
{
appendStringInfo(context->buf, "%s%d.%s%d",
SUBQUERY_REL_ALIAS_PREFIX, relno,
SUBQUERY_COL_ALIAS_PREFIX, colno);
return;
}
if (bms_is_member(node->varno, relids) && node->varlevelsup == 0)
{
/* Var belongs to foreign table */
sqlite_deparse_column_ref(buf, node->varno, node->varattno, context->root, qualify_col, false);
}
else
{
/* Treat like a Param */
if (context->params_list)
{
int pindex = 0;
ListCell *lc;
/* find its index in params_list */
foreach(lc, *context->params_list)
{
pindex++;
if (equal(node, (Node *) lfirst(lc)))
break;
}
if (lc == NULL)
{
/* not in list, so add it */
pindex++;
*context->params_list = lappend(*context->params_list, node);
}
sqlite_print_remote_param(pindex, node->vartype, node->vartypmod, context);
}
else
{
sqlite_print_remote_placeholder(node->vartype, node->vartypmod, context);
}
}
}
/*
* With this function, we try to obtain complementary node for operation to be able
* to obtain column name and column type to whom const value its compared to.
* If we obtain type, we know if we need to use datetime convert expressions
* or not depending if sqlite column is TEXT or INT */
static Var *
get_complementary_var_node(Expr *node)
{
if (node == NULL)
return NULL;
switch (nodeTag(node))
{
/* Only supported case by now is T_Var complementary node */
case T_Var:
return (Var *) node;
break;
default:
return NULL;
}
}
/*
* Deparse given constant value into context->buf.
*
* This function has to be kept in sync with ruleutils.c's get_const_expr.
* As for that function, showtype can be -1 to never show "::typename" decoration,
* or +1 to always show it, or 0 to show it only if the constant wouldn't be assumed
* to be the right type by default.
*/
static void
sqlite_deparse_const(Const *node, deparse_expr_cxt *context, int showtype)
{
StringInfo buf = context->buf;
Oid typoutput;
bool typIsVarlena;
char *extval;
char *sqlitecolumntype;
bool convert_timestamp_tounixepoch;
Var *varnode;
if (node->constisnull)
{
appendStringInfoString(buf, "NULL");
return;
}
getTypeOutputInfo(node->consttype,
&typoutput, &typIsVarlena);
switch (node->consttype)
{
/* popular first */
case VARCHAROID:
case CHAROID:
case TEXTOID:
case DATEOID:
case TIMEOID:
case NAMEOID:
case BPCHAROID:
{
/* common branch of constants, deparsable as a text data */
extval = OidOutputFunctionCall(typoutput, node->constvalue);
sqlite_deparse_string_literal(buf, extval);
break;
}
case INT2OID:
case INT4OID:
case INT8OID:
case OIDOID:
{
extval = OidOutputFunctionCall(typoutput, node->constvalue);
if (strspn(extval, "0123456789+-eE.") == strlen(extval))
{
if (extval[0] == '+' || extval[0] == '-')
appendStringInfo(buf, "(%s)", extval);
else
appendStringInfoString(buf, extval);
}
else
ereport(ERROR, (errcode(ERRCODE_FDW_INVALID_DATA_TYPE),
errmsg("Invalid input syntax. Invalid characters in number"),
errhint("Value: %s", extval)));
}
break;
case FLOAT4OID:
case FLOAT8OID:
case NUMERICOID:
{
extval = OidOutputFunctionCall(typoutput, node->constvalue);
/*
* No need to quote unless it's a special value such as 'NaN' or 'Infinity'.
* See comments in get_const_expr().
*/
if (strspn(extval, "0123456789+-eE.") == strlen(extval))
{
if (extval[0] == '+' || extval[0] == '-')
appendStringInfo(buf, "(%s)", extval);
else
appendStringInfoString(buf, extval);
}
else if (strcasecmp(extval, infs) == 0 ||
strcasecmp(extval, infl) == 0 ||
strcasecmp(extval + 1, infs) == 0 ||
strcasecmp(extval + 1, infl) == 0)
{
bool is_negative_or_positive = false;
if (extval[0] == '-' || extval[0] == '+')
is_negative_or_positive = true;
if (is_negative_or_positive)
appendStringInfo(buf, "(%c", extval[0]);
appendStringInfo(buf, "9e999");
if (is_negative_or_positive)
appendStringInfo(buf, ")");
}
else
{
/* NaN and other */
appendStringInfo(buf, "\'%s\'", extval);
}
}
break;
case BITOID:
case VARBITOID:
{
extval = OidOutputFunctionCall(typoutput, node->constvalue);
if (strlen(extval) > SQLITE_FDW_BIT_DATATYPE_BUF_SIZE - 1 )
{
ereport(ERROR, (errcode(ERRCODE_FDW_INVALID_DATA_TYPE),
errmsg("SQLite FDW doesn't support very long bit/varbit data"),
errhint("bit length %ld, maximum %ld", strlen(extval), SQLITE_FDW_BIT_DATATYPE_BUF_SIZE - 1)));
}
appendStringInfo(buf, "%lld", binstr2int64(extval));
}
break;
case BOOLOID:
{
extval = OidOutputFunctionCall(typoutput, node->constvalue);
if (strcmp(extval, "t") == 0)
appendStringInfoString(buf, "1");
else
appendStringInfoString(buf, "0");
}
break;
case BYTEAOID:
/*
* the string for BYTEA always seems to be in the format "\\x##"
* where # is a hex digit, Even if the value passed in is
* 'hi'::bytea we will receive "\x6869". Making this assumption
* allows us to quickly convert Postgres escaped strings to SQLite
* ones for comparison
*/
extval = OidOutputFunctionCall(typoutput, node->constvalue);
appendStringInfo(buf, "X\'%s\'", extval + 2);
break;
case TIMESTAMPOID:
{
convert_timestamp_tounixepoch = false;
extval = OidOutputFunctionCall(typoutput, node->constvalue);
if (context->complementarynode != NULL)
{
varnode = get_complementary_var_node(context->complementarynode);
if (varnode != NULL)
{
sqlitecolumntype = sqlite_deparse_column_option(varnode->varno, varnode->varattno, context->root, "column_type");
if (sqlitecolumntype != NULL && strcasecmp(sqlitecolumntype, "INT") == 0)
convert_timestamp_tounixepoch = true;
}
}
if (convert_timestamp_tounixepoch)
appendStringInfo(buf, "strftime('%%s', '%s')", extval);
else
sqlite_deparse_string_literal(buf, extval);
}
break;
case UUIDOID:
/*
* always deparse to BLOB, in case of UPDATE with text affinity
* transformation function will be added
*/
{
int i = 0;
extval = OidOutputFunctionCall(typoutput, node->constvalue);
appendStringInfo(buf, "X\'");
for (i = 0; i < strlen(extval); i++)
{
char c = extval[i];
if ( c != '-')
appendStringInfoChar(buf, c);
}
appendStringInfo(buf, "\'");
}
break;
case MACADDROID:
case MACADDR8OID:
{
int i = 0;
extval = OidOutputFunctionCall(typoutput, node->constvalue);
appendStringInfo(buf, "0x");
for (i = 0; i < strlen(extval); i++)
{
char c = extval[i];
if ( c != '-' && c != '.' && c != ':')
appendStringInfoChar(buf, c);
}
}
break;
case JSONBOID:
{
extval = OidOutputFunctionCall(typoutput, node->constvalue);
appendStringInfo(buf, "jsonb(");
sqlite_deparse_string_literal(buf, extval);
appendStringInfo(buf, ")");
}
break;
case JSONOID:
{
extval = OidOutputFunctionCall(typoutput, node->constvalue);
appendStringInfo(buf, "json(");
sqlite_deparse_string_literal(buf, extval);
appendStringInfo(buf, ")");
}
break;
default:
{
if (listed_datatype_oid(node->consttype, -1, postGisSQLiteCompatibleTypes))
{
/* common branch of PostGIS constants, deparsable as a text data */
elog(DEBUG2, "sqlite_fdw : %s deparse PostGIS constant", __func__);
extval = OidOutputFunctionCall(typoutput, node->constvalue);
#ifdef SQLITE_FDW_GIS_ENABLE
sqlite_deparse_PostGIS_value(buf, extval);
#else
sqlite_deparse_string_literal(buf, extval);
#endif
}
else
{
const char *pg_dataTypeName = TypeNameToString(makeTypeNameFromOid(node->consttype, -1));
extval = OidOutputFunctionCall(typoutput, node->constvalue);
ereport(ERROR, (errcode(ERRCODE_FDW_INVALID_DATA_TYPE),
errmsg("Unknown data type of a constant"),
errhint("Data type: \"%s\" ", pg_dataTypeName),
errcontext("Value: %s", extval)));
}
}
}
}
/*
* Deparse given Param node.
*
* If we're generating the query "for real", add the Param to
* context->params_list if it's not already present, and then use its index
* in that list as the remote parameter number. During EXPLAIN, there's
* no need to identify a parameter number.
*/
static void
sqlite_deparse_param(Param *node, deparse_expr_cxt *context)
{
if (context->params_list)
{
int pindex = 0;
ListCell *lc;
/* find its index in params_list */
foreach(lc, *context->params_list)
{
pindex++;
if (equal(node, (Node *) lfirst(lc)))
break;
}
if (lc == NULL)
{
/* not in list, so add it */
pindex++;
*context->params_list = lappend(*context->params_list, node);
}
sqlite_print_remote_param(pindex, node->paramtype, node->paramtypmod, context);
}
else
{
sqlite_print_remote_placeholder(node->paramtype, node->paramtypmod, context);
}
}
/*
* This possible that name of function in PostgreSQL and
* sqlite differ, so return the sqlite equelent function name
*/
static char *
sqlite_replace_function(char *in)
{
if (strcmp(in, "btrim") == 0)
{
return "trim";
}
return in;
}
/*
* Deparse a function call.
*/
static void
sqlite_deparse_func_expr(FuncExpr *node, deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
HeapTuple proctup;
Form_pg_proc procform;
const char *proname;
bool first;
ListCell *arg;
/*
* If the function call came from an implicit coercion, then just show the
* first argument.
*/
if (node->funcformat == COERCE_IMPLICIT_CAST)
{
sqlite_deparse_expr((Expr *) linitial(node->args), context);
return;
}
/*
* Normal function: display as proname(args).
*/
proctup = SearchSysCache1(PROCOID, ObjectIdGetDatum(node->funcid));
if (!HeapTupleIsValid(proctup))
elog(ERROR, "cache lookup failed for function %u", node->funcid);
procform = (Form_pg_proc) GETSTRUCT(proctup);
/* Translate PostgreSQL function into sqlite function */
proname = sqlite_replace_function(NameStr(procform->proname));
/* Deparse the function name ... */
appendStringInfo(buf, "%s(", proname);
/* ... and all the arguments */
first = true;
foreach(arg, node->args)
{
if (!first)
appendStringInfoString(buf, ", ");
sqlite_deparse_expr((Expr *) lfirst(arg), context);
first = false;
}
appendStringInfoChar(buf, ')');
ReleaseSysCache(proctup);
}
/*
* Deparse given operator expression. To avoid problems around
* priority of operations, we always parenthesize the arguments.
*/
static void
sqlite_deparse_op_expr(OpExpr *node, deparse_expr_cxt *context)
{
StringInfo buf = context->buf;
HeapTuple tuple;
Form_pg_operator form;
char oprkind;
/* Retrieve information about the operator from system catalog. */
tuple = SearchSysCache1(OPEROID, ObjectIdGetDatum(node->opno));
if (!HeapTupleIsValid(tuple))
elog(ERROR, "cache lookup failed for operator %u", node->opno);
form = (Form_pg_operator) GETSTRUCT(tuple);
oprkind = form->oprkind;
/* Sanity check. */
Assert((oprkind == 'l' && list_length(node->args) == 1) ||
(oprkind == 'b' && list_length(node->args) == 2));
/* Always parenthesize the expression. */
appendStringInfoChar(buf, '(');
/* Deparse left operand. */
if (oprkind == 'b')
{
context->complementarynode = llast(node->args);
sqlite_deparse_expr(linitial(node->args), context);
appendStringInfoChar(buf, ' ');
}
/* Deparse operator name. */
sqlite_deparse_operator_name(buf, form);
/* Deparse right operand. */
appendStringInfoChar(buf, ' ');
if (oprkind == 'b')
context->complementarynode = linitial(node->args);
sqlite_deparse_expr(llast(node->args), context);
appendStringInfoChar(buf, ')');
ReleaseSysCache(tuple);
}
/*
* Gets SQLite SQL operand or other value for an operator.
*/
static void
sqlite_deparse_operator_name(StringInfo buf, Form_pg_operator opform)
{
char *cur_opname = NULL;
/* opname is not a SQL identifier, so we should not quote it. */
cur_opname = NameStr(opform->oprname);
/*
* Non built-in operators, for example PostGIS
* This operators doesn't belong to pg_catalog
*/
if (opform->oprnamespace != PG_CATALOG_NAMESPACE)
{
/* Don't use fully qualified operator name for SQLite, only name. */
appendStringInfoString(buf, cur_opname);
}
else
{
if (strcmp(cur_opname, "~~") == 0)
{
appendStringInfoString(buf, "LIKE");
}
else if (strcmp(cur_opname, "!~~") == 0)
{
appendStringInfoString(buf, "NOT LIKE");
}
else if (strcmp(cur_opname, "~~*")
gitextract_jct4ly9d/ ├── .dockerignore ├── .gitattributes ├── .github/ │ └── workflows/ │ └── CI.yml ├── .gitignore ├── GIS.md ├── GitHubActions/ │ ├── README.md │ ├── build_postgis.sh │ ├── build_postgres.sh │ ├── build_sqlite_fdw.sh │ ├── detect_targets.sh │ ├── download_postgis.sh │ ├── env.sh │ ├── execute_test.sh │ ├── install_locales.sh │ └── install_sqlite.sh ├── License ├── META.json ├── Makefile ├── README.md ├── connection.c ├── deparse.c ├── option.c ├── sql/ │ ├── 13.15/ │ │ ├── aggregate.sql │ │ ├── extra/ │ │ │ ├── aggregates.sql │ │ │ ├── encodings.sql │ │ │ ├── insert.sql │ │ │ ├── join.sql │ │ │ ├── limit.sql │ │ │ ├── prepare.sql │ │ │ ├── select.sql │ │ │ ├── select_having.sql │ │ │ ├── sqlite_fdw_post.sql │ │ │ └── update.sql │ │ ├── libsqlite.sql │ │ ├── selectfunc.sql │ │ ├── sqlite_fdw.sql │ │ ├── types/ │ │ │ ├── bitstring.sql │ │ │ ├── bool.sql │ │ │ ├── float4.sql │ │ │ ├── float8.sql │ │ │ ├── int4.sql │ │ │ ├── int8.sql │ │ │ ├── json.sql │ │ │ ├── macaddr.sql │ │ │ ├── macaddr8.sql │ │ │ ├── numeric.sql │ │ │ ├── out_of_range.sql │ │ │ ├── timestamp.sql │ │ │ └── uuid.sql │ │ ├── with_gis_support/ │ │ │ ├── auto_import.sql │ │ │ ├── postgis.sql │ │ │ └── type.sql │ │ └── without_gis_support/ │ │ ├── auto_import.sql │ │ ├── nogis.sql │ │ └── type.sql │ ├── 14.12/ │ │ ├── aggregate.sql │ │ ├── extra/ │ │ │ ├── aggregates.sql │ │ │ ├── encodings.sql │ │ │ ├── insert.sql │ │ │ ├── join.sql │ │ │ ├── limit.sql │ │ │ ├── prepare.sql │ │ │ ├── select.sql │ │ │ ├── select_having.sql │ │ │ ├── sqlite_fdw_post.sql │ │ │ └── update.sql │ │ ├── libsqlite.sql │ │ ├── selectfunc.sql │ │ ├── sqlite_fdw.sql │ │ ├── types/ │ │ │ ├── bitstring.sql │ │ │ ├── bool.sql │ │ │ ├── float4.sql │ │ │ ├── float8.sql │ │ │ ├── int4.sql │ │ │ ├── int8.sql │ │ │ ├── json.sql │ │ │ ├── macaddr.sql │ │ │ ├── macaddr8.sql │ │ │ ├── numeric.sql │ │ │ ├── out_of_range.sql │ │ │ ├── timestamp.sql │ │ │ └── uuid.sql │ │ ├── with_gis_support/ │ │ │ ├── auto_import.sql │ │ │ ├── postgis.sql │ │ │ └── type.sql │ │ └── without_gis_support/ │ │ ├── auto_import.sql │ │ ├── nogis.sql │ │ └── type.sql │ ├── 15.7/ │ │ ├── aggregate.sql │ │ ├── extra/ │ │ │ ├── aggregates.sql │ │ │ ├── encodings.sql │ │ │ ├── insert.sql │ │ │ ├── join.sql │ │ │ ├── limit.sql │ │ │ ├── prepare.sql │ │ │ ├── select.sql │ │ │ ├── select_having.sql │ │ │ ├── sqlite_fdw_post.sql │ │ │ └── update.sql │ │ ├── libsqlite.sql │ │ ├── selectfunc.sql │ │ ├── sqlite_fdw.sql │ │ ├── types/ │ │ │ ├── bitstring.sql │ │ │ ├── bool.sql │ │ │ ├── float4.sql │ │ │ ├── float8.sql │ │ │ ├── int4.sql │ │ │ ├── int8.sql │ │ │ ├── json.sql │ │ │ ├── macaddr.sql │ │ │ ├── macaddr8.sql │ │ │ ├── numeric.sql │ │ │ ├── out_of_range.sql │ │ │ ├── timestamp.sql │ │ │ └── uuid.sql │ │ ├── with_gis_support/ │ │ │ ├── auto_import.sql │ │ │ ├── postgis.sql │ │ │ └── type.sql │ │ └── without_gis_support/ │ │ ├── auto_import.sql │ │ ├── nogis.sql │ │ └── type.sql │ ├── 16.3/ │ │ ├── aggregate.sql │ │ ├── extra/ │ │ │ ├── aggregates.sql │ │ │ ├── encodings.sql │ │ │ ├── insert.sql │ │ │ ├── join.sql │ │ │ ├── limit.sql │ │ │ ├── prepare.sql │ │ │ ├── select.sql │ │ │ ├── select_having.sql │ │ │ ├── sqlite_fdw_post.sql │ │ │ └── update.sql │ │ ├── libsqlite.sql │ │ ├── selectfunc.sql │ │ ├── sqlite_fdw.sql │ │ ├── types/ │ │ │ ├── bitstring.sql │ │ │ ├── bool.sql │ │ │ ├── float4.sql │ │ │ ├── float8.sql │ │ │ ├── int4.sql │ │ │ ├── int8.sql │ │ │ ├── json.sql │ │ │ ├── macaddr.sql │ │ │ ├── macaddr8.sql │ │ │ ├── numeric.sql │ │ │ ├── out_of_range.sql │ │ │ ├── timestamp.sql │ │ │ └── uuid.sql │ │ ├── with_gis_support/ │ │ │ ├── auto_import.sql │ │ │ ├── postgis.sql │ │ │ └── type.sql │ │ └── without_gis_support/ │ │ ├── auto_import.sql │ │ ├── nogis.sql │ │ └── type.sql │ ├── 17.0/ │ │ ├── aggregate.sql │ │ ├── extra/ │ │ │ ├── aggregates.sql │ │ │ ├── encodings.sql │ │ │ ├── insert.sql │ │ │ ├── join.sql │ │ │ ├── limit.sql │ │ │ ├── prepare.sql │ │ │ ├── select.sql │ │ │ ├── select_having.sql │ │ │ ├── sqlite_fdw_post.sql │ │ │ └── update.sql │ │ ├── libsqlite.sql │ │ ├── selectfunc.sql │ │ ├── sqlite_fdw.sql │ │ ├── types/ │ │ │ ├── bitstring.sql │ │ │ ├── bool.sql │ │ │ ├── float4.sql │ │ │ ├── float8.sql │ │ │ ├── int4.sql │ │ │ ├── int8.sql │ │ │ ├── json.sql │ │ │ ├── macaddr.sql │ │ │ ├── macaddr8.sql │ │ │ ├── numeric.sql │ │ │ ├── out_of_range.sql │ │ │ ├── timestamp.sql │ │ │ └── uuid.sql │ │ ├── with_gis_support/ │ │ │ ├── auto_import.sql │ │ │ ├── postgis.sql │ │ │ └── type.sql │ │ └── without_gis_support/ │ │ ├── auto_import.sql │ │ ├── nogis.sql │ │ └── type.sql │ └── init_data/ │ ├── agg.data │ ├── datetimes.data │ ├── init.sql │ ├── init_core.sql │ ├── init_post.sql │ ├── init_selectfunc.sql │ ├── onek.data │ ├── person.data │ ├── streets.data │ ├── student.data │ └── tenk.data ├── sqlite_data_norm.c ├── sqlite_fdw--1.0--1.1.sql ├── sqlite_fdw--1.0.sql ├── sqlite_fdw.c ├── sqlite_fdw.control ├── sqlite_fdw.h ├── sqlite_fdw.vcxproj ├── sqlite_gis.c ├── sqlite_query.c └── test.sh
SYMBOL INDEX (2078 symbols across 164 files)
FILE: connection.c
type Oid (line 32) | typedef Oid ConnCacheKey;
type ConnCacheEntry (line 34) | typedef struct ConnCacheEntry
type BusyHandlerArg (line 81) | typedef struct BusyHandlerArg
function sqlite3 (line 94) | sqlite3 *
function sqlite3 (line 190) | static sqlite3 *
function sqlite_make_new_connection (line 228) | static void
function sqlite_cleanup_connection (line 267) | void
function sqlite_do_sql_command (line 302) | void
function sqlite_begin_remote_xact (line 357) | static void
function sqlitefdw_report_error (line 396) | void
function sqlitefdw_xact_callback (line 425) | static void
function sqlitefdw_reset_xact_state (line 526) | static void
function sqlitefdw_subxact_callback (line 553) | static void
function sqlitefdw_inval_callback (line 650) | static void
function Datum (line 702) | Datum
function Datum (line 849) | Datum
function Datum (line 877) | Datum
function sqlitefdw_abort_cleanup (line 896) | static void
function sqlite_disconnect_cached_connections (line 951) | static bool
function sqlite_cache_stmt (line 1022) | void
function sqlite_finalize_list_stmt (line 1043) | static void
function List (line 1063) | static List *
FILE: deparse.c
type foreign_glob_cxt (line 43) | typedef struct foreign_glob_cxt
type FDWCollateState (line 55) | typedef enum
type foreign_loc_cxt (line 62) | typedef struct foreign_loc_cxt
type deparse_expr_cxt (line 71) | typedef struct deparse_expr_cxt
function sqlite_deparse_relation (line 188) | static void
function sqlite_is_foreign_expr (line 238) | bool
function sqlite_is_foreign_param (line 301) | bool
function sqlite_deparsable_data_type (line 344) | static bool
function sqlite_is_foreign_pathkey (line 383) | bool
function sqlite_foreign_expr_walker (line 444) | static bool
function List (line 1249) | List *
function sqlite_deparse_select_stmt_for_rel (line 1304) | void
function sqlite_deparse_select (line 1378) | static void
function sqlite_deparse_from_expr (line 1436) | static void
function sqlite_append_conditions (line 1480) | static void
function sqlite_deparse_explicit_target_list (line 1552) | static void
function sqlite_deparse_subquery_target_list (line 1583) | static void
function sqlite_deparse_from_expr_for_rel (line 1631) | static void
function sqlite_deparse_range_tbl_ref (line 1896) | static void
function sqlite_rebuild_insert (line 2058) | void
function sqlite_deparse_analyze (line 2106) | void
function sqlite_deparse_target_list (line 2119) | static void
function sqlite_append_where_clause (line 2190) | void
function sqlite_deparse_truncate (line 2227) | void
function sqlite_deparse_column_ref (line 2252) | static void
function sqlite_deparse_string_literal (line 2550) | void
function sqlite_deparse_expr (line 2580) | static void
function preferred_sqlite_affinity (line 2698) | int
function sqlite_deparse_direct_update_sql (line 2737) | void
function sqlite_deparse_delete (line 2876) | void
function sqlite_deparse_direct_delete_sql (line 2909) | void
function sqlite_deparse_var (line 2970) | static void
function Var (line 3034) | static Var *
function sqlite_deparse_const (line 3059) | static void
function sqlite_deparse_param (line 3293) | static void
function sqlite_deparse_func_expr (line 3340) | static void
function sqlite_deparse_op_expr (line 3391) | static void
function sqlite_deparse_operator_name (line 3440) | static void
function sqlite_deparse_scalar_array_op_expr (line 3491) | static void
function sqlite_deparse_relabel_type (line 3701) | static void
function sqlite_deparse_bool_expr (line 3713) | static void
function sqlite_deparse_null_test (line 3751) | static void
function sqlite_deparse_array_expr (line 3767) | static void
function sqlite_deparse_case_expr (line 3788) | static void
function sqlite_deparse_null_if_expr (line 3835) | static void
function sqlite_deparse_coalesce_expr (line 3850) | static void
function sqlite_print_remote_param (line 3877) | static void
function sqlite_print_remote_placeholder (line 3886) | static void
function sqlite_is_builtin (line 3913) | bool
function sqlite_deparse_aggref (line 3926) | static void
function sqlite_append_group_by_clause (line 4022) | static void
function sqlite_append_agg_order_by (line 4065) | static void
function sqlite_append_order_by_clause (line 4098) | static void
function sqlite_append_order_by_suffix (line 4209) | static void sqlite_append_order_by_suffix(Oid sortop, Oid sortcoltype,
function sqlite_append_limit_clause (line 4237) | static void
function sqlite_append_function_name (line 4275) | static void
function Node (line 4310) | static Node *
function sqlite_is_subquery_var (line 4353) | static bool
function sqlite_get_relation_column_alias_ids (line 4415) | static void
function sqlite_contain_immutable_functions (line 4470) | static bool
function sqlite_contain_immutable_functions_walker (line 4476) | static bool
function sqlite_is_foreign_function_tlist (line 4515) | bool
function sqlite_classify_conditions (line 4593) | void
FILE: option.c
type SqliteFdwOption (line 31) | struct SqliteFdwOption
type SqliteFdwOption (line 42) | struct SqliteFdwOption
function Datum (line 76) | Datum
function sqlite_is_valid_option (line 183) | bool
function sqlite_opt (line 199) | sqlite_opt *
FILE: sql/13.15/aggregate.sql
type multiprimary (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type multiprimary (line 19) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type limittest (line 49) | CREATE FOREIGN TABLE limittest(id serial OPTIONS (key 'true')
FILE: sql/13.15/extra/aggregates.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type aggtest (line 30) | CREATE FOREIGN TABLE aggtest (
type student (line 36) | CREATE FOREIGN TABLE student (
type tenk1 (line 44) | CREATE FOREIGN TABLE tenk1 (
type INT8_TBL (line 64) | CREATE FOREIGN TABLE INT8_TBL(
type INT4_TBL (line 80) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type multi_arg_agg (line 93) | CREATE FOREIGN TABLE multi_arg_agg (a int OPTIONS (key 'true')
type VARCHAR_TBL (line 96) | CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')
type FLOAT8_TBL (line 99) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type agg_tb (line 121) | CREATE FOREIGN TABLE agg_tb(v int, id integer OPTIONS (key 'true')
type agg_tb2 (line 142) | CREATE FOREIGN TABLE agg_tb2(v text)
type agg_t3 (line 211) | CREATE FOREIGN TABLE agg_t3(a float8, b float8, id integer OPTIONS (key ...
type agg_t4 (line 245) | CREATE FOREIGN TABLE agg_t4(a float4, b float4, id integer OPTIONS (key ...
type agg_t5 (line 279) | CREATE FOREIGN TABLE agg_t5(a numeric, b numeric, id integer OPTIONS (ke...
type agg_t8 (line 319) | CREATE FOREIGN TABLE agg_t8(a text OPTIONS (key 'true')
type agg_t6 (line 418) | CREATE FOREIGN TABLE agg_t6(a float8, id integer OPTIONS (key 'true')
type agg_t7 (line 469) | CREATE FOREIGN TABLE agg_t7(a float8, b float8, c float8, d float8, id i...
type regr_test (line 493) | CREATE FOREIGN TABLE regr_test (x float8, y float8, id int options (key ...
type agg_t15 (line 515) | CREATE FOREIGN TABLE agg_t15 (a text, b int, c int, id int options (key ...
type agg_t16 (line 539) | CREATE FOREIGN TABLE agg_t16 (a text, b text, id int options (key 'true')
function sum3 (line 612) | create function sum3(int8,int8,int8) returns int8 as
type bitwise_test (line 688) | CREATE FOREIGN TABLE bitwise_test(
type bool_test_tmp (line 737) | CREATE FOREIGN TABLE bool_test_tmp(
type bool_test (line 809) | CREATE FOREIGN TABLE bool_test(
type minmaxtest (line 957) | create foreign table minmaxtest(f1 int)
type minmaxtest1 (line 959) | create table minmaxtest1() inherits (minmaxtest)
type minmaxtest2 (line 961) | create table minmaxtest2() inherits (minmaxtest)
type minmaxtest3 (line 963) | create table minmaxtest3() inherits (minmaxtest)
type minmaxtest1i (line 965) | create index minmaxtest1i on minmaxtest1(f1)
type minmaxtest2i (line 967) | create index minmaxtest2i on minmaxtest2(f1 desc)
type minmaxtest3i (line 969) | create index minmaxtest3i on minmaxtest3(f1) where f1 is not null
type agg_t1 (line 1006) | create foreign table agg_t1 (a int OPTIONS (key 'true')
type agg_t2 (line 1008) | create foreign table agg_t2 (x int OPTIONS (key 'true')
type agg_t9 (line 1010) | create foreign table agg_t9 (a int OPTIONS (key 'true')
type t1c (line 1037) | create temp table t1c () inherits (agg_t1)
type t1 (line 1070) | create foreign table t1(f1 int, f2 int)
type t2 (line 1072) | create foreign table t2(f1 bigint, f2 oid)
function aggf_trans (line 1204) | create function aggf_trans(aggtype[],integer,integer,text) returns aggty...
function aggfns_trans (line 1209) | create function aggfns_trans(aggtype[],integer,integer,text) returns agg...
type agg_view1 (line 1257) | create view agg_view1 as
type agg_view1 (line 1266) | create or replace view agg_view1 as
type agg_view1 (line 1275) | create or replace view agg_view1 as
type agg_view1 (line 1284) | create or replace view agg_view1 as
type agg_view1 (line 1293) | create or replace view agg_view1 as
type agg_view1 (line 1302) | create or replace view agg_view1 as
type agg_view1 (line 1311) | create or replace view agg_view1 as
type bytea_test_table (line 1379) | create foreign table bytea_test_table(v bytea)
type pagg_test (line 1404) | create foreign table pagg_test (x int, y int)
type v_pagg_test (line 1417) | create view v_pagg_test AS
type agg_t17 (line 1485) | create foreign table agg_t17(foo text, bar text)
type agg_t170 (line 1493) | create foreign table agg_t170(v int)
type agg_t18 (line 1499) | create foreign table agg_t18 (inner_c int)
type agg_t19 (line 1501) | create foreign table agg_t19 (outer_c int)
type agg_t21 (line 1651) | create foreign table agg_t21 (x int)
type agg_t20 (line 1664) | create foreign table agg_t20 (x text)
type aggordview1 (line 1794) | create view aggordview1 as
function least_accum (line 1811) | create function least_accum(anyelement, variadic anyarray)
function cleast_accum (line 1821) | create function cleast_accum(anycompatible, variadic anycompatiblearray)
type agg_t10 (line 1845) | create foreign table agg_t10(one int, id int options (key 'true')
type agg_t11 (line 1847) | create foreign table agg_t11(one int, two int, id int options (key 'true')
type agg_t12 (line 1849) | create foreign table agg_t12(a int, id int options (key 'true')
function avg_transfn (line 1856) | create or replace function avg_transfn(state avg_state, n int) returns a...
function avg_finalfn (line 1879) | create function avg_finalfn(state avg_state) returns int4 as
function sum_finalfn (line 1891) | create function sum_finalfn(state avg_state) returns int4 as
function sum_transfn (line 2030) | create or replace function sum_transfn(state int4, n int4) returns int4 as
function halfsum_finalfn (line 2051) | create function halfsum_finalfn(state int4) returns int4 as
function balkifnull (line 2094) | CREATE FUNCTION balkifnull(int8, int4)
function balkifnull (line 2124) | CREATE FUNCTION balkifnull(int8, int8)
function rwagg_sfunc (line 2160) | CREATE FUNCTION rwagg_sfunc(x anyarray, y anyarray) RETURNS anyarray
function rwagg_finalfunc (line 2167) | CREATE FUNCTION rwagg_finalfunc(x anyarray) RETURNS anyarray
function eatarray (line 2184) | CREATE FUNCTION eatarray(x real[]) RETURNS real[]
type float_tb (line 2192) | CREATE FOREIGN TABLE float_tb(f real)
type agg_t13 (line 2254) | create foreign table agg_t13(x int, id int options (key 'true')
type agg_t14 (line 2267) | create foreign table agg_t14(x int, y int, id int options (key 'true')
type agg_data_2k (line 2333) | create foreign table agg_data_2k(g int, id int options (key 'true')
type agg_data_20k (line 2335) | create foreign table agg_data_20k(g int, id int options (key 'true')
type agg_group_1 (line 2338) | create foreign table agg_group_1(c1 int, c2 numeric, c3 int)
type agg_group_2 (line 2340) | create foreign table agg_group_2(a int, c1 numeric, c2 text, c3 int)
type agg_group_3 (line 2342) | create foreign table agg_group_3(c1 numeric, c2 int4, c3 int)
type agg_group_4 (line 2344) | create foreign table agg_group_4(c1 numeric, c2 text, c3 int)
type agg_hash_1 (line 2347) | create foreign table agg_hash_1(c1 int, c2 numeric, c3 int)
type agg_hash_2 (line 2349) | create foreign table agg_hash_2(a int, c1 numeric, c2 text, c3 int)
type agg_hash_3 (line 2351) | create foreign table agg_hash_3(c1 numeric, c2 int4, c3 int)
type agg_hash_4 (line 2353) | create foreign table agg_hash_4(c1 numeric, c2 text, c3 int)
FILE: sql/13.15/extra/encodings.sql
type "Unicode data" (line 42) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 54) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 191) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 328) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 465) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 602) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 739) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 876) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1013) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1150) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1287) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1424) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1561) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1698) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1835) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1972) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2109) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2246) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2383) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2520) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2657) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2794) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2931) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3068) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3205) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3343) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3480) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/13.15/extra/insert.sql
type inserttest01 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/13.15/extra/join.sql
type J1_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type J2_TBL (line 19) | CREATE FOREIGN TABLE J2_TBL (
type tenk1 (line 25) | CREATE FOREIGN TABLE tenk1 (
type tenk2 (line 45) | CREATE FOREIGN TABLE tenk2 (
type INT4_TBL (line 65) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type FLOAT8_TBL (line 78) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type INT8_TBL (line 91) | CREATE FOREIGN TABLE INT8_TBL(
type INT2_TBL (line 107) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type onerow (line 153) | create temp table onerow();
type t31 (line 370) | CREATE FOREIGN TABLE t31 (name TEXT, n INTEGER)
type t12 (line 690) | CREATE FOREIGN TABLE t12 (a int OPTIONS (key 'true')
type t22 (line 692) | CREATE FOREIGN TABLE t22 (a int OPTIONS (key 'true')
type t32 (line 694) | CREATE FOREIGN TABLE t32 (x int OPTIONS (key 'true')
type t2a (line 731) | create temp table t2a () inherits (t22)
type tt1 (line 752) | CREATE FOREIGN TABLE tt1 ( tt1_id int4, joincol int4 )
type tt2 (line 759) | CREATE FOREIGN TABLE tt2 ( tt2_id int4, joincol int4 )
type tt3 (line 802) | create foreign table tt3(f1 int, f2 text)
type tt4 (line 807) | create foreign table tt4(f1 int)
type tt4x (line 826) | create foreign table tt4x(c1 int, c2 int, c3 int)
type tt5 (line 845) | create foreign table tt5(f1 int, f2 int)
type tt6 (line 847) | create foreign table tt6(f1 int, f2 int)
type xx (line 869) | create foreign table xx (pkxx int)
type yy (line 871) | create foreign table yy (pkyy int, pkxx int)
type zt1 (line 901) | create foreign table zt1 (f1 int OPTIONS(key 'true')
type zt2 (line 903) | create foreign table zt2 (f2 int OPTIONS(key 'true')
type zt3 (line 905) | create foreign table zt3 (f3 int OPTIONS(key 'true')
type zv1 (line 918) | create temp view zv1 as select *,'dummy'::text AS junk from zt1
type a1 (line 964) | create foreign table a1 (i integer)
type b1 (line 966) | create foreign table b1 (x integer, y integer)
type a2 (line 1024) | create foreign table a2 (
type b2 (line 1028) | create foreign table b2 (
type c2 (line 1033) | create foreign table c2 (
type sub_tbl (line 1071) | create foreign table sub_tbl (key1 int, key3 int, key5 int, key6 int, va...
type nt1 (line 1138) | create foreign table nt1 (
type nt2 (line 1144) | create foreign table nt2 (
type nt3 (line 1151) | create foreign table nt3 (
type q1 (line 1238) | create foreign table q1(i int)
type q2 (line 1242) | create foreign table q2(i int)
function f_immutable_int4 (line 1369) | create function f_immutable_int4(i integer) returns integer as
function mki8 (line 1434) | create function mki8(bigint, bigint) returns int8_tbl as
function mki4 (line 1438) | create function mki4(int) returns int4_tbl as
type text_tbl (line 1635) | create foreign table text_tbl(f1 text)
type a3 (line 1881) | CREATE FOREIGN TABLE a3 (id int OPTIONS (key 'true')
type b3 (line 1883) | CREATE FOREIGN TABLE b3 (id int OPTIONS (key 'true')
type c3 (line 1885) | CREATE FOREIGN TABLE c3 (id int OPTIONS (key 'true')
type d3 (line 1887) | CREATE FOREIGN TABLE d3 (a int, b int)
type a4 (line 2015) | CREATE FOREIGN TABLE a4 (id int OPTIONS (key 'true')
type b4 (line 2017) | CREATE FOREIGN TABLE b4 (id int OPTIONS (key 'true')
type innertab (line 2034) | create foreign table innertab (id int8 options (key 'true')
type uniquetbl (line 2052) | create foreign table uniquetbl (f1 text)
type xx1 (line 2461) | create temp table xx1 as select f1 as x1, -f1 as x2 from int4_tbl
type fkest (line 2514) | create foreign table fkest (a int options (key 'true')
type fkest1 (line 2516) | create foreign table fkest1 (a int options (key 'true')
type j11 (line 2545) | create foreign table j11 (id int options (key 'true')
type j21 (line 2547) | create foreign table j21 (id int options (key 'true')
type j31 (line 2549) | create foreign table j31 (id int)
type j32 (line 2621) | create foreign table j32 (id1 int options (key 'true')
type onek (line 2717) | CREATE FOREIGN TABLE onek (
type j3 (line 2746) | create table j3 as select unique1, tenthous from onek
type j3 (line 2749) | create unique index on j3(unique1, tenthous)
FILE: sql/13.15/extra/limit.sql
type onek (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type int8_tbl (line 31) | CREATE FOREIGN TABLE int8_tbl(q1 int8 OPTIONS (key 'true')
type INT8_TMP (line 44) | CREATE FOREIGN TABLE INT8_TMP(
type tenk1 (line 54) | CREATE FOREIGN TABLE tenk1 (
type parent_table (line 74) | CREATE TABLE parent_table (
type limit_thousand_v_1 (line 410) | CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_2 (line 415) | CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 420) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 423) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_4 (line 428) | CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousa...
FILE: sql/13.15/extra/prepare.sql
type tenk1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type road (line 31) | CREATE FOREIGN TABLE road (
type road_tmp (line 37) | create foreign table road_tmp (a int, b int, id int options (key 'true')
FILE: sql/13.15/extra/select.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type onek2 (line 31) | CREATE FOREIGN TABLE onek2 (
type INT8_TBL (line 51) | CREATE FOREIGN TABLE INT8_TBL(
type person (line 67) | CREATE FOREIGN TABLE person (
function sillysrf (line 363) | create function sillysrf(int) returns setof int as
type list_parted_tbl (line 384) | create table list_parted_tbl (a int,b int) partition by list (a)
type list_parted_tbl1 (line 386) | create table list_parted_tbl1 partition of list_parted_tbl
FILE: sql/13.15/extra/select_having.sql
type test_having (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/13.15/extra/sqlite_fdw_post.sql
type ft1 (line 72) | CREATE FOREIGN TABLE ft1 (
type ft2 (line 86) | CREATE FOREIGN TABLE ft2 (
type ft5 (line 100) | CREATE FOREIGN TABLE ft4 (
type ft2 (line 114) | CREATE FOREIGN TABLE ft6 (
type v4 (line 684) | CREATE VIEW v4 AS SELECT * FROM ft4
type v5 (line 686) | CREATE VIEW v5 AS SELECT * FROM ft5
function least_accum (line 916) | create function least_accum(anyelement, variadic anyarray)
function f_test (line 1314) | CREATE OR REPLACE FUNCTION f_test(p_c1 int) RETURNS int AS $$
type ft3 (line 1370) | create foreign table ft3 (f1 text collate "C", f2 text, f3 varchar(10))
function "S 1" (line 1564) | CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$
type ft1_constraint (line 1590) | CREATE FOREIGN TABLE ft1_constraint (
function row_before_insupd_trigfunc (line 1743) | CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN ...
type foreign_tbl (line 1746) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type rw_view (line 1751) | CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
type foreign_tbl (line 1790) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type parent_tbl (line 1796) | CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a)
type rw_view (line 1800) | CREATE VIEW rw_view AS SELECT * FROM parent_tbl
type loc1 (line 1845) | create foreign table loc1 (f1 serial, f2 text, id integer options (key '...
type grem1 (line 1869) | create foreign table grem1 (
function trigger_func (line 1886) | CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS $$
function trigger_data (line 1901) | CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
function trig_null (line 2138) | CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$
type a (line 2321) | CREATE TABLE a (aa TEXT)
type foo (line 2394) | create table foo (f1 int, f2 int)
type bar (line 2396) | create foreign table foo2 (f3 int OPTIONS (key 'true')) inherits (foo)
type bar (line 2401) | create foreign table bar2 (f3 int OPTIONS (key 'true')) inherits (bar)
type i_foo_f1 (line 2482) | create index i_foo_f1 on foo(f1)
type parent (line 2554) | create table parent (a int, b text)
FILE: sql/13.15/extra/update.sql
type update_test (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type upsert_test (line 19) | CREATE FOREIGN TABLE upsert_test (
FILE: sql/13.15/selectfunc.sql
type s3 (line 13) | CREATE FOREIGN TABLE s3(id text OPTIONS (key 'true')
FILE: sql/13.15/sqlite_fdw.sql
type department (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type employee (line 11) | CREATE FOREIGN TABLE employee(emp_id int OPTIONS (key 'true')
type empdata (line 13) | CREATE FOREIGN TABLE empdata(emp_id int OPTIONS (key 'true')
type numbers (line 15) | CREATE FOREIGN TABLE numbers(a int OPTIONS (key 'true')
type multiprimary (line 17) | CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true')
type noprimary (line 19) | CREATE FOREIGN TABLE noprimary(a int, b text)
type RO_RW_test (line 21) | CREATE FOREIGN TABLE RO_RW_test(i int OPTIONS (key 'true')
function test_param_WHERE (line 128) | create or replace function test_param_WHERE() returns void as $$
type columntest (line 514) | CREATE FOREIGN TABLE columntest(a int OPTIONS(column_name 'a a', key 'tr...
type fts_table (line 542) | CREATE FOREIGN TABLE fts_table (name text, description text)
type case_exp (line 578) | CREATE FOREIGN TABLE case_exp(c1 int OPTIONS (key 'true')
FILE: sql/13.15/types/bitstring.sql
type "type_BIT" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_VARBIT" (line 45) | CREATE FOREIGN TABLE "type_VARBIT"( "i" int OPTIONS (key 'true'), "b" va...
FILE: sql/13.15/types/bool.sql
type "type_BOOLEAN" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_BOOLEANpk" (line 93) | CREATE FOREIGN TABLE "type_BOOLEANpk" (col bool OPTIONS (key 'true')
FILE: sql/13.15/types/float4.sql
type FLOAT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT4_TMP (line 12) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
function xfloat4in (line 424) | create function xfloat4in(cstring) returns xfloat4 immutable strict
function xfloat4out (line 427) | create function xfloat4out(xfloat4) returns cstring immutable strict
type testdata (line 447) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/13.15/types/float8.sql
type FLOAT8_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT8_TMP (line 12) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
function xfloat8in (line 692) | create function xfloat8in(cstring) returns xfloat8 immutable strict
function xfloat8out (line 695) | create function xfloat8out(xfloat8) returns cstring immutable strict
type testdata (line 715) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/13.15/types/int4.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 12) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type FLOAT8_TMP (line 282) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 300) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
FILE: sql/13.15/types/int8.sql
type INT8_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT8_TMP (line 16) | CREATE FOREIGN TABLE INT8_TMP(
type FLOAT8_TMP (line 528) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 546) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
FILE: sql/13.15/types/json.sql
type "type_JSON" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_JSONB" (line 21) | CREATE FOREIGN TABLE "type_JSONB" (
type "type_JSONB+" (line 32) | CREATE FOREIGN TABLE "type_JSONB+" (
type json_osm_test (line 804) | CREATE FOREIGN TABLE json_osm_test (
FILE: sql/13.15/types/numeric.sql
type num_data (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type num_exp_add (line 13) | CREATE FOREIGN TABLE num_exp_add (id1 int4 OPTIONS (key 'true')
type num_exp_sub (line 15) | CREATE FOREIGN TABLE num_exp_sub (id1 int4 OPTIONS (key 'true')
type num_exp_div (line 17) | CREATE FOREIGN TABLE num_exp_div (id1 int4 OPTIONS (key 'true')
type num_exp_mul (line 19) | CREATE FOREIGN TABLE num_exp_mul (id1 int4 OPTIONS (key 'true')
type num_exp_sqrt (line 21) | CREATE FOREIGN TABLE num_exp_sqrt (id int4 OPTIONS (key 'true')
type num_exp_ln (line 23) | CREATE FOREIGN TABLE num_exp_ln (id int4 OPTIONS (key 'true')
type num_exp_log10 (line 25) | CREATE FOREIGN TABLE num_exp_log10 (id int4 OPTIONS (key 'true')
type num_exp_power_10_ln (line 27) | CREATE FOREIGN TABLE num_exp_power_10_ln (id int4 OPTIONS (key 'true')
type num_result (line 30) | CREATE FOREIGN TABLE num_result (id1 int4 OPTIONS (key 'true')
type fract_only (line 1152) | CREATE FOREIGN TABLE fract_only (id int, val numeric(4,4))
type FLOAT8_TMP (line 1176) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type FLOAT4_TMP (line 1200) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type ceil_floor_round (line 1224) | CREATE FOREIGN TABLE ceil_floor_round (a numeric OPTIONS (key 'true')
type INT4_TMP (line 1244) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type width_bucket_tbl (line 1263) | CREATE FOREIGN TABLE width_bucket_tbl (
type width_bucket_test (line 1330) | CREATE FOREIGN TABLE width_bucket_test (
type to_number_tbl (line 1494) | create foreign table to_number_tbl (a text, id int options (key 'true')
type num_input_test (line 1656) | CREATE FOREIGN TABLE num_input_test (n1 numeric)
type num_tmp (line 1699) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
FILE: sql/13.15/types/out_of_range.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 13) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type INT2_TBL (line 42) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type INT2_TMP (line 44) | CREATE FOREIGN TABLE INT2_TMP(f1 int2, f2 int2, id int OPTIONS (key 'true')
type INT8_TBL (line 73) | CREATE FOREIGN TABLE INT8_TBL(q1 int8 OPTIONS (key 'true')
FILE: sql/13.15/types/timestamp.sql
type dates1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type dates2 (line 18) | CREATE FOREIGN TABLE dates2 (
FILE: sql/13.15/types/uuid.sql
type "type_UUIDpk" (line 210) | CREATE FOREIGN TABLE "type_UUIDpk" (col uuid OPTIONS (key 'true')
FILE: sql/13.15/with_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/13.15/with_gis_support/postgis.sql
type "♂" (line 18) | CREATE TABLE "♂"."テスト" (
type "♁" (line 43) | CREATE TABLE "♁" (
type "types_PostGIS" (line 165) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 219) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 245) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/13.15/with_gis_support/type.sql
type "type_BOOLEAN" (line 144) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/13.15/without_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/13.15/without_gis_support/nogis.sql
type "types_PostGIS" (line 43) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 81) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 107) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/13.15/without_gis_support/type.sql
type "type_BOOLEAN" (line 141) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/14.12/aggregate.sql
type multiprimary (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type multiprimary (line 19) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type limittest (line 49) | CREATE FOREIGN TABLE limittest(id serial OPTIONS (key 'true')
FILE: sql/14.12/extra/aggregates.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type aggtest (line 30) | CREATE FOREIGN TABLE aggtest (
type student (line 36) | CREATE FOREIGN TABLE student (
type tenk1 (line 44) | CREATE FOREIGN TABLE tenk1 (
type INT8_TBL (line 64) | CREATE FOREIGN TABLE INT8_TBL(
type INT4_TBL (line 80) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type multi_arg_agg (line 93) | CREATE FOREIGN TABLE multi_arg_agg (a int OPTIONS (key 'true')
type VARCHAR_TBL (line 96) | CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')
type FLOAT8_TBL (line 99) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type agg_tb (line 121) | CREATE FOREIGN TABLE agg_tb(v int, id integer OPTIONS (key 'true')
type agg_tb2 (line 142) | CREATE FOREIGN TABLE agg_tb2(v text)
type agg_t3 (line 211) | CREATE FOREIGN TABLE agg_t3(a float8, b float8, id integer OPTIONS (key ...
type agg_t4 (line 245) | CREATE FOREIGN TABLE agg_t4(a float4, b float4, id integer OPTIONS (key ...
type agg_t5 (line 279) | CREATE FOREIGN TABLE agg_t5(a numeric, b numeric, id integer OPTIONS (ke...
type agg_t8 (line 319) | CREATE FOREIGN TABLE agg_t8(a text OPTIONS (key 'true')
type agg_t6 (line 418) | CREATE FOREIGN TABLE agg_t6(a float8, id integer OPTIONS (key 'true')
type agg_t7 (line 469) | CREATE FOREIGN TABLE agg_t7(a float8, b float8, c float8, d float8, id i...
type regr_test (line 493) | CREATE FOREIGN TABLE regr_test (x float8, y float8, id int options (key ...
type agg_t15 (line 515) | CREATE FOREIGN TABLE agg_t15 (a text, b int, c int, id int options (key ...
type agg_t16 (line 539) | CREATE FOREIGN TABLE agg_t16 (a text, b text, id int options (key 'true')
function sum3 (line 612) | create function sum3(int8,int8,int8) returns int8 as
type bitwise_test (line 688) | CREATE FOREIGN TABLE bitwise_test(
type bool_test_tmp (line 737) | CREATE FOREIGN TABLE bool_test_tmp(
type bool_test (line 809) | CREATE FOREIGN TABLE bool_test(
type minmaxtest (line 957) | create foreign table minmaxtest(f1 int)
type minmaxtest1 (line 959) | create table minmaxtest1() inherits (minmaxtest)
type minmaxtest2 (line 961) | create table minmaxtest2() inherits (minmaxtest)
type minmaxtest3 (line 963) | create table minmaxtest3() inherits (minmaxtest)
type minmaxtest1i (line 965) | create index minmaxtest1i on minmaxtest1(f1)
type minmaxtest2i (line 967) | create index minmaxtest2i on minmaxtest2(f1 desc)
type minmaxtest3i (line 969) | create index minmaxtest3i on minmaxtest3(f1) where f1 is not null
type agg_t1 (line 1006) | create foreign table agg_t1 (a int OPTIONS (key 'true')
type agg_t2 (line 1008) | create foreign table agg_t2 (x int OPTIONS (key 'true')
type agg_t9 (line 1010) | create foreign table agg_t9 (a int OPTIONS (key 'true')
type t1c (line 1037) | create temp table t1c () inherits (agg_t1)
type t1 (line 1070) | create foreign table t1(f1 int, f2 int)
type t2 (line 1072) | create foreign table t2(f1 bigint, f2 oid)
function aggf_trans (line 1204) | create function aggf_trans(aggtype[],integer,integer,text) returns aggty...
function aggfns_trans (line 1209) | create function aggfns_trans(aggtype[],integer,integer,text) returns agg...
type agg_view1 (line 1257) | create view agg_view1 as
type agg_view1 (line 1266) | create or replace view agg_view1 as
type agg_view1 (line 1275) | create or replace view agg_view1 as
type agg_view1 (line 1284) | create or replace view agg_view1 as
type agg_view1 (line 1293) | create or replace view agg_view1 as
type agg_view1 (line 1302) | create or replace view agg_view1 as
type agg_view1 (line 1311) | create or replace view agg_view1 as
type bytea_test_table (line 1379) | create foreign table bytea_test_table(v bytea)
type pagg_test (line 1404) | create foreign table pagg_test (x int, y int)
type v_pagg_test (line 1417) | create view v_pagg_test AS
type agg_t17 (line 1485) | create foreign table agg_t17(foo text, bar text)
type agg_t170 (line 1493) | create foreign table agg_t170(v int)
type agg_t18 (line 1499) | create foreign table agg_t18 (inner_c int)
type agg_t19 (line 1501) | create foreign table agg_t19 (outer_c int)
type agg_t21 (line 1651) | create foreign table agg_t21 (x int)
type agg_t20 (line 1664) | create foreign table agg_t20 (x text)
type aggordview1 (line 1794) | create view aggordview1 as
function least_accum (line 1811) | create function least_accum(anyelement, variadic anyarray)
function cleast_accum (line 1821) | create function cleast_accum(anycompatible, variadic anycompatiblearray)
type agg_t10 (line 1845) | create foreign table agg_t10(one int, id int options (key 'true')
type agg_t11 (line 1847) | create foreign table agg_t11(one int, two int, id int options (key 'true')
type agg_t12 (line 1849) | create foreign table agg_t12(a int, id int options (key 'true')
function avg_transfn (line 1856) | create or replace function avg_transfn(state avg_state, n int) returns a...
function avg_finalfn (line 1879) | create function avg_finalfn(state avg_state) returns int4 as
function sum_finalfn (line 1891) | create function sum_finalfn(state avg_state) returns int4 as
function sum_transfn (line 2030) | create or replace function sum_transfn(state int4, n int4) returns int4 as
function halfsum_finalfn (line 2051) | create function halfsum_finalfn(state int4) returns int4 as
function balkifnull (line 2094) | CREATE FUNCTION balkifnull(int8, int4)
function balkifnull (line 2124) | CREATE FUNCTION balkifnull(int8, int8)
function rwagg_sfunc (line 2160) | CREATE FUNCTION rwagg_sfunc(x anyarray, y anyarray) RETURNS anyarray
function rwagg_finalfunc (line 2167) | CREATE FUNCTION rwagg_finalfunc(x anyarray) RETURNS anyarray
function eatarray (line 2184) | CREATE FUNCTION eatarray(x real[]) RETURNS real[]
type float_tb (line 2192) | CREATE FOREIGN TABLE float_tb(f real)
type agg_t13 (line 2254) | create foreign table agg_t13(x int, id int options (key 'true')
type agg_t14 (line 2267) | create foreign table agg_t14(x int, y int, id int options (key 'true')
type agg_data_2k (line 2333) | create foreign table agg_data_2k(g int, id int options (key 'true')
type agg_data_20k (line 2335) | create foreign table agg_data_20k(g int, id int options (key 'true')
type agg_group_1 (line 2338) | create foreign table agg_group_1(c1 int, c2 numeric, c3 int)
type agg_group_2 (line 2340) | create foreign table agg_group_2(a int, c1 numeric, c2 text, c3 int)
type agg_group_3 (line 2342) | create foreign table agg_group_3(c1 numeric, c2 int4, c3 int)
type agg_group_4 (line 2344) | create foreign table agg_group_4(c1 numeric, c2 text, c3 int)
type agg_hash_1 (line 2347) | create foreign table agg_hash_1(c1 int, c2 numeric, c3 int)
type agg_hash_2 (line 2349) | create foreign table agg_hash_2(a int, c1 numeric, c2 text, c3 int)
type agg_hash_3 (line 2351) | create foreign table agg_hash_3(c1 numeric, c2 int4, c3 int)
type agg_hash_4 (line 2353) | create foreign table agg_hash_4(c1 numeric, c2 text, c3 int)
FILE: sql/14.12/extra/encodings.sql
type "Unicode data" (line 42) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 54) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 191) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 328) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 465) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 602) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 739) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 876) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1013) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1150) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1287) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1424) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1561) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1698) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1835) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1972) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2109) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2246) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2383) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2520) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2657) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2794) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2931) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3068) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3205) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3343) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3480) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/14.12/extra/insert.sql
type inserttest01 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/14.12/extra/join.sql
type J1_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type J2_TBL (line 19) | CREATE FOREIGN TABLE J2_TBL (
type tenk1 (line 25) | CREATE FOREIGN TABLE tenk1 (
type tenk2 (line 45) | CREATE FOREIGN TABLE tenk2 (
type INT4_TBL (line 65) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type FLOAT8_TBL (line 78) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type INT8_TBL (line 91) | CREATE FOREIGN TABLE INT8_TBL(
type INT2_TBL (line 107) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type onerow (line 153) | create temp table onerow();
type t31 (line 401) | CREATE FOREIGN TABLE t31 (name TEXT, n INTEGER)
type t12 (line 723) | CREATE FOREIGN TABLE t12 (a int OPTIONS (key 'true')
type t22 (line 725) | CREATE FOREIGN TABLE t22 (a int OPTIONS (key 'true')
type t32 (line 727) | CREATE FOREIGN TABLE t32 (x int OPTIONS (key 'true')
type t2a (line 764) | create temp table t2a () inherits (t22)
type tt1 (line 785) | CREATE FOREIGN TABLE tt1 ( tt1_id int4, joincol int4 )
type tt2 (line 792) | CREATE FOREIGN TABLE tt2 ( tt2_id int4, joincol int4 )
type tt3 (line 847) | create foreign table tt3(f1 int, f2 text)
type tt4 (line 852) | create foreign table tt4(f1 int)
type tt4x (line 871) | create foreign table tt4x(c1 int, c2 int, c3 int)
type tt5 (line 890) | create foreign table tt5(f1 int, f2 int)
type tt6 (line 892) | create foreign table tt6(f1 int, f2 int)
type xx (line 914) | create foreign table xx (pkxx int)
type yy (line 916) | create foreign table yy (pkyy int, pkxx int)
type zt1 (line 946) | create foreign table zt1 (f1 int OPTIONS(key 'true')
type zt2 (line 948) | create foreign table zt2 (f2 int OPTIONS(key 'true')
type zt3 (line 950) | create foreign table zt3 (f3 int OPTIONS(key 'true')
type zv1 (line 963) | create temp view zv1 as select *,'dummy'::text AS junk from zt1
type a1 (line 1012) | create foreign table a1 (i integer)
type b1 (line 1014) | create foreign table b1 (x integer, y integer)
type a2 (line 1072) | create foreign table a2 (
type b2 (line 1076) | create foreign table b2 (
type c2 (line 1081) | create foreign table c2 (
type sub_tbl (line 1119) | create foreign table sub_tbl (key1 int, key3 int, key5 int, key6 int, va...
type nt1 (line 1186) | create foreign table nt1 (
type nt2 (line 1192) | create foreign table nt2 (
type nt3 (line 1199) | create foreign table nt3 (
type q1 (line 1315) | create foreign table q1(i int)
type q2 (line 1319) | create foreign table q2(i int)
function f_immutable_int4 (line 1470) | create function f_immutable_int4(i integer) returns integer as
function mki8 (line 1539) | create function mki8(bigint, bigint) returns int8_tbl as
function mki4 (line 1543) | create function mki4(int) returns int4_tbl as
type text_tbl (line 1740) | create foreign table text_tbl(f1 text)
type a3 (line 1990) | CREATE FOREIGN TABLE a3 (id int OPTIONS (key 'true')
type b3 (line 1992) | CREATE FOREIGN TABLE b3 (id int OPTIONS (key 'true')
type c3 (line 1994) | CREATE FOREIGN TABLE c3 (id int OPTIONS (key 'true')
type d3 (line 1996) | CREATE FOREIGN TABLE d3 (a int, b int)
type a4 (line 2124) | CREATE FOREIGN TABLE a4 (id int OPTIONS (key 'true')
type b4 (line 2126) | CREATE FOREIGN TABLE b4 (id int OPTIONS (key 'true')
type innertab (line 2143) | create foreign table innertab (id int8 options (key 'true')
type uniquetbl (line 2161) | create foreign table uniquetbl (f1 text)
type xx1 (line 2603) | create temp table xx1 as select f1 as x1, -f1 as x2 from int4_tbl
type fkest (line 2656) | create table fkest (x integer, x10 integer, x10b integer, x100 integer)
type fkest (line 2660) | create unique index on fkest(x, x10, x100)
type fkest (line 2690) | create foreign table fkest (a int options (key 'true')
type fkest1 (line 2692) | create foreign table fkest1 (a int options (key 'true')
type j11 (line 2721) | create foreign table j11 (id int options (key 'true')
type j21 (line 2723) | create foreign table j21 (id int options (key 'true')
type j31 (line 2725) | create foreign table j31 (id int)
type j32 (line 2797) | create foreign table j32 (id1 int options (key 'true')
type onek (line 2899) | CREATE FOREIGN TABLE onek (
type j3 (line 2928) | create table j3 as select unique1, tenthous from onek
type j3 (line 2931) | create unique index on j3(unique1, tenthous)
FILE: sql/14.12/extra/limit.sql
type onek (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type int8_tbl (line 31) | CREATE FOREIGN TABLE int8_tbl(q1 int8 OPTIONS (key 'true')
type INT8_TMP (line 44) | CREATE FOREIGN TABLE INT8_TMP(
type tenk1 (line 54) | CREATE FOREIGN TABLE tenk1 (
type parent_table (line 74) | CREATE TABLE parent_table (
type limit_thousand_v_1 (line 410) | CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_2 (line 415) | CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 420) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 423) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_4 (line 428) | CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousa...
FILE: sql/14.12/extra/prepare.sql
type tenk1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type road (line 31) | CREATE FOREIGN TABLE road (
type road_tmp (line 37) | create foreign table road_tmp (a int, b int, id int options (key 'true')
FILE: sql/14.12/extra/select.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type onek2 (line 31) | CREATE FOREIGN TABLE onek2 (
type INT8_TBL (line 51) | CREATE FOREIGN TABLE INT8_TBL(
type person (line 68) | CREATE FOREIGN TABLE person (
function sillysrf (line 364) | create function sillysrf(int) returns setof int as
type list_parted_tbl (line 385) | create table list_parted_tbl (a int,b int) partition by list (a)
type list_parted_tbl1 (line 387) | create table list_parted_tbl1 partition of list_parted_tbl
FILE: sql/14.12/extra/select_having.sql
type test_having (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/14.12/extra/sqlite_fdw_post.sql
type ft1 (line 75) | CREATE FOREIGN TABLE ft1 (
type ft2 (line 90) | CREATE FOREIGN TABLE ft2 (
type ft5 (line 105) | CREATE FOREIGN TABLE ft4 (
type ft2 (line 119) | CREATE FOREIGN TABLE ft6 (
type v4 (line 730) | CREATE VIEW v4 AS SELECT * FROM ft4
type v5 (line 732) | CREATE VIEW v5 AS SELECT * FROM ft5
function least_accum (line 966) | create function least_accum(anyelement, variadic anyarray)
function f_test (line 1382) | CREATE OR REPLACE FUNCTION f_test(p_c1 int) RETURNS int AS $$
type reind_fdw_parent (line 1402) | CREATE FOREIGN TABLE reindex_foreign (c1 int, c2 int)
type ft3 (line 1466) | create foreign table ft3 (f1 text collate "C", f2 text, f3 varchar(10))
function "S 1" (line 1670) | CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$
type ft1_constraint (line 1696) | CREATE FOREIGN TABLE ft1_constraint (
function row_before_insupd_trigfunc (line 1857) | CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN ...
type foreign_tbl (line 1860) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type rw_view (line 1865) | CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
type foreign_tbl (line 1904) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type parent_tbl (line 1910) | CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a)
type rw_view (line 1915) | CREATE VIEW rw_view AS SELECT * FROM parent_tbl
type loc1 (line 1960) | create foreign table loc1 (f1 serial, f2 text, id integer options (key '...
type grem1 (line 1984) | create foreign table grem1 (
function trigger_func (line 2032) | CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS $$
function trigger_data (line 2047) | CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
function trig_null (line 2284) | CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$
type a (line 2473) | CREATE TABLE a (aa TEXT)
type foo (line 2547) | create table foo (f1 int, f2 int)
type bar (line 2549) | create foreign table foo2 (f3 int OPTIONS (key 'true')) inherits (foo)
type bar (line 2554) | create foreign table bar2 (f3 int OPTIONS (key 'true')) inherits (bar)
type foo2child (line 2598) | create foreign table foo2child (f3 int)
type i_foo_f1 (line 2667) | create index i_foo_f1 on foo(f1)
type parent (line 2741) | create table parent (a int, b text)
type "S 1" (line 3151) | CREATE FOREIGN TABLE tru_pk_ftable (id int)
type table30 (line 3819) | CREATE FOREIGN TABLE table30 ( x int )
type batch_size (line 3845) | CREATE FOREIGN TABLE ftable ( x int OPTIONS (key 'true') ) SERVER sqlite...
type batch_size (line 3877) | CREATE FOREIGN TABLE ftable ( x int ) SERVER sqlite_svr OPTIONS ( table ...
type inv_bsz (line 4206) | CREATE FOREIGN TABLE inv_bsz (c1 int )
FILE: sql/14.12/extra/update.sql
type update_test (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type upsert_test (line 19) | CREATE FOREIGN TABLE upsert_test (
FILE: sql/14.12/selectfunc.sql
type s3 (line 13) | CREATE FOREIGN TABLE s3(id text OPTIONS (key 'true')
FILE: sql/14.12/sqlite_fdw.sql
type department (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type employee (line 11) | CREATE FOREIGN TABLE employee(emp_id int OPTIONS (key 'true')
type empdata (line 13) | CREATE FOREIGN TABLE empdata(emp_id int OPTIONS (key 'true')
type numbers (line 15) | CREATE FOREIGN TABLE numbers(a int OPTIONS (key 'true')
type multiprimary (line 17) | CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true')
type noprimary (line 19) | CREATE FOREIGN TABLE noprimary(a int, b text)
type RO_RW_test (line 22) | CREATE FOREIGN TABLE RO_RW_test(i int OPTIONS (key 'true')
function test_param_WHERE (line 129) | create or replace function test_param_WHERE() returns void as $$
type columntest (line 511) | CREATE FOREIGN TABLE columntest(a int OPTIONS(column_name 'a a', key 'tr...
type fts_table (line 539) | CREATE FOREIGN TABLE fts_table (name text, description text)
type grem1_2 (line 585) | CREATE FOREIGN TABLE grem1_2 (
type case_exp (line 598) | CREATE FOREIGN TABLE case_exp(c1 int OPTIONS (key 'true')
FILE: sql/14.12/types/bitstring.sql
type "type_BIT" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_VARBIT" (line 45) | CREATE FOREIGN TABLE "type_VARBIT"( "i" int OPTIONS (key 'true'), "b" va...
FILE: sql/14.12/types/bool.sql
type "type_BOOLEAN" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_BOOLEANpk" (line 93) | CREATE FOREIGN TABLE "type_BOOLEANpk" (col bool OPTIONS (key 'true')
FILE: sql/14.12/types/float4.sql
type FLOAT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT4_TMP (line 12) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
function xfloat4in (line 436) | create function xfloat4in(cstring) returns xfloat4 immutable strict
function xfloat4out (line 439) | create function xfloat4out(xfloat4) returns cstring immutable strict
type testdata (line 459) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/14.12/types/float8.sql
type FLOAT8_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT8_TMP (line 12) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
function xfloat8in (line 879) | create function xfloat8in(cstring) returns xfloat8 immutable strict
function xfloat8out (line 882) | create function xfloat8out(xfloat8) returns cstring immutable strict
type testdata (line 902) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/14.12/types/int4.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 12) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type FLOAT8_TMP (line 268) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 286) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
FILE: sql/14.12/types/int8.sql
type INT8_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT8_TMP (line 16) | CREATE FOREIGN TABLE INT8_TMP(
type FLOAT8_TMP (line 528) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 546) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
FILE: sql/14.12/types/json.sql
type "type_JSON" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_JSONB" (line 21) | CREATE FOREIGN TABLE "type_JSONB" (
type "type_JSONB+" (line 32) | CREATE FOREIGN TABLE "type_JSONB+" (
type json_osm_test (line 804) | CREATE FOREIGN TABLE json_osm_test (
FILE: sql/14.12/types/numeric.sql
type num_data (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type num_exp_add (line 13) | CREATE FOREIGN TABLE num_exp_add (id1 int4 OPTIONS (key 'true')
type num_exp_sub (line 15) | CREATE FOREIGN TABLE num_exp_sub (id1 int4 OPTIONS (key 'true')
type num_exp_div (line 17) | CREATE FOREIGN TABLE num_exp_div (id1 int4 OPTIONS (key 'true')
type num_exp_mul (line 19) | CREATE FOREIGN TABLE num_exp_mul (id1 int4 OPTIONS (key 'true')
type num_exp_sqrt (line 21) | CREATE FOREIGN TABLE num_exp_sqrt (id int4 OPTIONS (key 'true')
type num_exp_ln (line 23) | CREATE FOREIGN TABLE num_exp_ln (id int4 OPTIONS (key 'true')
type num_exp_log10 (line 25) | CREATE FOREIGN TABLE num_exp_log10 (id int4 OPTIONS (key 'true')
type num_exp_power_10_ln (line 27) | CREATE FOREIGN TABLE num_exp_power_10_ln (id int4 OPTIONS (key 'true')
type num_result (line 30) | CREATE FOREIGN TABLE num_result (id1 int4 OPTIONS (key 'true')
type v (line 1145) | CREATE FOREIGN TABLE v (id int4 OPTIONS (key 'true')
type fract_only (line 1546) | CREATE FOREIGN TABLE fract_only (id int, val numeric(4,4))
type num_tmp (line 1580) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
type FLOAT8_TMP (line 1673) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type NUMERIC_TMP (line 1696) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, f2 numeric, id int OPTIONS ...
type FLOAT4_TMP (line 1719) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type ceil_floor_round (line 1834) | CREATE FOREIGN TABLE ceil_floor_round (a numeric OPTIONS (key 'true')
type INT4_TMP (line 1854) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type width_bucket_tbl (line 1873) | CREATE FOREIGN TABLE width_bucket_tbl (
type width_bucket_test (line 1953) | CREATE FOREIGN TABLE width_bucket_test (
type to_number_tbl (line 2196) | create foreign table to_number_tbl (a text, id int options (key 'true')
type num_input_test (line 2360) | CREATE FOREIGN TABLE num_input_test (n1 numeric)
type num_tmp (line 2417) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
FILE: sql/14.12/types/out_of_range.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 13) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type INT2_TBL (line 42) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type INT2_TMP (line 44) | CREATE FOREIGN TABLE INT2_TMP(f1 int2, f2 int2, id int OPTIONS (key 'true')
type INT8_TBL (line 73) | CREATE FOREIGN TABLE INT8_TBL(q1 int8 OPTIONS (key 'true')
FILE: sql/14.12/types/timestamp.sql
type dates1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type dates2 (line 18) | CREATE FOREIGN TABLE dates2 (
FILE: sql/14.12/types/uuid.sql
type "type_UUIDpk" (line 210) | CREATE FOREIGN TABLE "type_UUIDpk" (col uuid OPTIONS (key 'true')
FILE: sql/14.12/with_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/14.12/with_gis_support/postgis.sql
type "♂" (line 18) | CREATE TABLE "♂"."テスト" (
type "♁" (line 43) | CREATE TABLE "♁" (
type "types_PostGIS" (line 165) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 219) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 245) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/14.12/with_gis_support/type.sql
type "type_BOOLEAN" (line 144) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/14.12/without_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/14.12/without_gis_support/nogis.sql
type "types_PostGIS" (line 43) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 81) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 107) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/14.12/without_gis_support/type.sql
type "type_BOOLEAN" (line 141) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/15.7/aggregate.sql
type multiprimary (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type multiprimary (line 19) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type limittest (line 49) | CREATE FOREIGN TABLE limittest(id serial OPTIONS (key 'true')
FILE: sql/15.7/extra/aggregates.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type aggtest (line 30) | CREATE FOREIGN TABLE aggtest (
type student (line 36) | CREATE FOREIGN TABLE student (
type tenk1 (line 44) | CREATE FOREIGN TABLE tenk1 (
type INT8_TBL (line 64) | CREATE FOREIGN TABLE INT8_TBL(
type INT4_TBL (line 80) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type multi_arg_agg (line 93) | CREATE FOREIGN TABLE multi_arg_agg (a int OPTIONS (key 'true')
type VARCHAR_TBL (line 96) | CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')
type FLOAT8_TBL (line 99) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type agg_tb (line 121) | CREATE FOREIGN TABLE agg_tb(v int, id integer OPTIONS (key 'true')
type agg_tb2 (line 142) | CREATE FOREIGN TABLE agg_tb2(v text)
type agg_t3 (line 211) | CREATE FOREIGN TABLE agg_t3(a float8, b float8, id integer OPTIONS (key ...
type agg_t4 (line 245) | CREATE FOREIGN TABLE agg_t4(a float4, b float4, id integer OPTIONS (key ...
type agg_t5 (line 279) | CREATE FOREIGN TABLE agg_t5(a numeric, b numeric, id integer OPTIONS (ke...
type agg_t8 (line 319) | CREATE FOREIGN TABLE agg_t8(a text OPTIONS (key 'true')
type agg_t6 (line 418) | CREATE FOREIGN TABLE agg_t6(a float8, id integer OPTIONS (key 'true')
type agg_t7 (line 469) | CREATE FOREIGN TABLE agg_t7(a float8, b float8, c float8, d float8, id i...
type regr_test (line 493) | CREATE FOREIGN TABLE regr_test (x float8, y float8, id int options (key ...
type agg_t15 (line 515) | CREATE FOREIGN TABLE agg_t15 (a text, b int, c int, id int options (key ...
type agg_t16 (line 539) | CREATE FOREIGN TABLE agg_t16 (a text, b text, id int options (key 'true')
function sum3 (line 612) | create function sum3(int8,int8,int8) returns int8 as
type bitwise_test (line 688) | CREATE FOREIGN TABLE bitwise_test(
type bool_test_tmp (line 737) | CREATE FOREIGN TABLE bool_test_tmp(
type bool_test (line 809) | CREATE FOREIGN TABLE bool_test(
type minmaxtest (line 957) | create foreign table minmaxtest(f1 int)
type minmaxtest1 (line 959) | create table minmaxtest1() inherits (minmaxtest)
type minmaxtest2 (line 961) | create table minmaxtest2() inherits (minmaxtest)
type minmaxtest3 (line 963) | create table minmaxtest3() inherits (minmaxtest)
type minmaxtest1i (line 965) | create index minmaxtest1i on minmaxtest1(f1)
type minmaxtest2i (line 967) | create index minmaxtest2i on minmaxtest2(f1 desc)
type minmaxtest3i (line 969) | create index minmaxtest3i on minmaxtest3(f1) where f1 is not null
type agg_t1 (line 1006) | create foreign table agg_t1 (a int OPTIONS (key 'true')
type agg_t2 (line 1008) | create foreign table agg_t2 (x int OPTIONS (key 'true')
type agg_t9 (line 1010) | create foreign table agg_t9 (a int OPTIONS (key 'true')
type t1c (line 1037) | create temp table t1c () inherits (agg_t1)
type t1 (line 1070) | create foreign table t1(f1 int, f2 int)
type t2 (line 1072) | create foreign table t2(f1 bigint, f2 oid)
function aggf_trans (line 1204) | create function aggf_trans(aggtype[],integer,integer,text) returns aggty...
function aggfns_trans (line 1209) | create function aggfns_trans(aggtype[],integer,integer,text) returns agg...
type agg_view1 (line 1257) | create view agg_view1 as
type agg_view1 (line 1266) | create or replace view agg_view1 as
type agg_view1 (line 1275) | create or replace view agg_view1 as
type agg_view1 (line 1284) | create or replace view agg_view1 as
type agg_view1 (line 1293) | create or replace view agg_view1 as
type agg_view1 (line 1302) | create or replace view agg_view1 as
type agg_view1 (line 1311) | create or replace view agg_view1 as
type bytea_test_table (line 1379) | create foreign table bytea_test_table(v bytea)
type pagg_test (line 1404) | create foreign table pagg_test (x int, y int)
type v_pagg_test (line 1417) | create view v_pagg_test AS
type agg_t17 (line 1485) | create foreign table agg_t17(foo text, bar text)
type agg_t170 (line 1493) | create foreign table agg_t170(v int)
type agg_t18 (line 1499) | create foreign table agg_t18 (inner_c int)
type agg_t19 (line 1501) | create foreign table agg_t19 (outer_c int)
type agg_t21 (line 1651) | create foreign table agg_t21 (x int)
type agg_t20 (line 1664) | create foreign table agg_t20 (x text)
type aggordview1 (line 1794) | create view aggordview1 as
function least_accum (line 1811) | create function least_accum(anyelement, variadic anyarray)
function cleast_accum (line 1821) | create function cleast_accum(anycompatible, variadic anycompatiblearray)
type agg_t10 (line 1845) | create foreign table agg_t10(one int, id int options (key 'true')
type agg_t11 (line 1847) | create foreign table agg_t11(one int, two int, id int options (key 'true')
type agg_t12 (line 1849) | create foreign table agg_t12(a int, id int options (key 'true')
function avg_transfn (line 1856) | create or replace function avg_transfn(state avg_state, n int) returns a...
function avg_finalfn (line 1879) | create function avg_finalfn(state avg_state) returns int4 as
function sum_finalfn (line 1891) | create function sum_finalfn(state avg_state) returns int4 as
function sum_transfn (line 2030) | create or replace function sum_transfn(state int4, n int4) returns int4 as
function halfsum_finalfn (line 2051) | create function halfsum_finalfn(state int4) returns int4 as
function balkifnull (line 2094) | CREATE FUNCTION balkifnull(int8, int4)
function balkifnull (line 2124) | CREATE FUNCTION balkifnull(int8, int8)
function rwagg_sfunc (line 2160) | CREATE FUNCTION rwagg_sfunc(x anyarray, y anyarray) RETURNS anyarray
function rwagg_finalfunc (line 2167) | CREATE FUNCTION rwagg_finalfunc(x anyarray) RETURNS anyarray
function eatarray (line 2184) | CREATE FUNCTION eatarray(x real[]) RETURNS real[]
type float_tb (line 2192) | CREATE FOREIGN TABLE float_tb(f real)
type agg_t13 (line 2254) | create foreign table agg_t13(x int, id int options (key 'true')
type agg_t14 (line 2267) | create foreign table agg_t14(x int, y int, id int options (key 'true')
type agg_data_2k (line 2333) | create foreign table agg_data_2k(g int, id int options (key 'true')
type agg_data_20k (line 2335) | create foreign table agg_data_20k(g int, id int options (key 'true')
type agg_group_1 (line 2338) | create foreign table agg_group_1(c1 int, c2 numeric, c3 int)
type agg_group_2 (line 2340) | create foreign table agg_group_2(a int, c1 numeric, c2 text, c3 int)
type agg_group_3 (line 2342) | create foreign table agg_group_3(c1 numeric, c2 int4, c3 int)
type agg_group_4 (line 2344) | create foreign table agg_group_4(c1 numeric, c2 text, c3 int)
type agg_hash_1 (line 2347) | create foreign table agg_hash_1(c1 int, c2 numeric, c3 int)
type agg_hash_2 (line 2349) | create foreign table agg_hash_2(a int, c1 numeric, c2 text, c3 int)
type agg_hash_3 (line 2351) | create foreign table agg_hash_3(c1 numeric, c2 int4, c3 int)
type agg_hash_4 (line 2353) | create foreign table agg_hash_4(c1 numeric, c2 text, c3 int)
FILE: sql/15.7/extra/encodings.sql
type "Unicode data" (line 42) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 54) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 191) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 328) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 465) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 602) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 739) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 876) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1013) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1150) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1287) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1424) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1561) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1698) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1835) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1972) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2109) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2246) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2383) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2520) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2657) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2794) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2931) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3068) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3205) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3343) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3480) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/15.7/extra/insert.sql
type inserttest01 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/15.7/extra/join.sql
type J1_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type J2_TBL (line 19) | CREATE FOREIGN TABLE J2_TBL (
type tenk1 (line 25) | CREATE FOREIGN TABLE tenk1 (
type tenk2 (line 45) | CREATE FOREIGN TABLE tenk2 (
type INT4_TBL (line 65) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type FLOAT8_TBL (line 78) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type INT8_TBL (line 91) | CREATE FOREIGN TABLE INT8_TBL(
type INT2_TBL (line 107) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type onerow (line 153) | create temp table onerow();
type t31 (line 401) | CREATE FOREIGN TABLE t31 (name TEXT, n INTEGER)
type t12 (line 723) | CREATE FOREIGN TABLE t12 (a int OPTIONS (key 'true')
type t22 (line 725) | CREATE FOREIGN TABLE t22 (a int OPTIONS (key 'true')
type t32 (line 727) | CREATE FOREIGN TABLE t32 (x int OPTIONS (key 'true')
type t2a (line 764) | create temp table t2a () inherits (t22)
type tt1 (line 812) | CREATE FOREIGN TABLE tt1 ( tt1_id int4, joincol int4 )
type tt2 (line 819) | CREATE FOREIGN TABLE tt2 ( tt2_id int4, joincol int4 )
type tt3 (line 874) | create foreign table tt3(f1 int, f2 text)
type tt4 (line 879) | create foreign table tt4(f1 int)
type tt4x (line 898) | create foreign table tt4x(c1 int, c2 int, c3 int)
type tt5 (line 917) | create foreign table tt5(f1 int, f2 int)
type tt6 (line 919) | create foreign table tt6(f1 int, f2 int)
type xx (line 941) | create foreign table xx (pkxx int)
type yy (line 943) | create foreign table yy (pkyy int, pkxx int)
type zt1 (line 973) | create foreign table zt1 (f1 int OPTIONS(key 'true')
type zt2 (line 975) | create foreign table zt2 (f2 int OPTIONS(key 'true')
type zt3 (line 977) | create foreign table zt3 (f3 int OPTIONS(key 'true')
type zv1 (line 990) | create temp view zv1 as select *,'dummy'::text AS junk from zt1
type a1 (line 1039) | create foreign table a1 (i integer)
type b1 (line 1041) | create foreign table b1 (x integer, y integer)
type a2 (line 1099) | create foreign table a2 (
type b2 (line 1103) | create foreign table b2 (
type c2 (line 1108) | create foreign table c2 (
type sub_tbl (line 1146) | create foreign table sub_tbl (key1 int, key3 int, key5 int, key6 int, va...
type nt1 (line 1213) | create foreign table nt1 (
type nt2 (line 1219) | create foreign table nt2 (
type nt3 (line 1226) | create foreign table nt3 (
type q1 (line 1342) | create foreign table q1(i int)
type q2 (line 1346) | create foreign table q2(i int)
function f_immutable_int4 (line 1497) | create function f_immutable_int4(i integer) returns integer as
function mki8 (line 1566) | create function mki8(bigint, bigint) returns int8_tbl as
function mki4 (line 1570) | create function mki4(int) returns int4_tbl as
type text_tbl (line 1767) | create foreign table text_tbl(f1 text)
type a3 (line 2017) | CREATE FOREIGN TABLE a3 (id int OPTIONS (key 'true')
type b3 (line 2019) | CREATE FOREIGN TABLE b3 (id int OPTIONS (key 'true')
type c3 (line 2021) | CREATE FOREIGN TABLE c3 (id int OPTIONS (key 'true')
type d3 (line 2023) | CREATE FOREIGN TABLE d3 (a int, b int)
type a4 (line 2151) | CREATE FOREIGN TABLE a4 (id int OPTIONS (key 'true')
type b4 (line 2153) | CREATE FOREIGN TABLE b4 (id int OPTIONS (key 'true')
type innertab (line 2170) | create foreign table innertab (id int8 options (key 'true')
type uniquetbl (line 2188) | create foreign table uniquetbl (f1 text)
type xx1 (line 2634) | create temp table xx1 as select f1 as x1, -f1 as x2 from int4_tbl
type fkest (line 2687) | create table fkest (x integer, x10 integer, x10b integer, x100 integer)
type fkest (line 2691) | create unique index on fkest(x, x10, x100)
type fkest (line 2721) | create foreign table fkest (a int options (key 'true')
type fkest1 (line 2723) | create foreign table fkest1 (a int options (key 'true')
type j11 (line 2752) | create foreign table j11 (id int options (key 'true')
type j21 (line 2754) | create foreign table j21 (id int options (key 'true')
type j31 (line 2756) | create foreign table j31 (id int)
type j32 (line 2828) | create foreign table j32 (id1 int options (key 'true')
type onek (line 2930) | CREATE FOREIGN TABLE onek (
type j3 (line 2959) | create table j3 as select unique1, tenthous from onek
type j3 (line 2962) | create unique index on j3(unique1, tenthous)
FILE: sql/15.7/extra/limit.sql
type onek (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type int8_tbl (line 31) | CREATE FOREIGN TABLE int8_tbl(q1 int8 OPTIONS (key 'true')
type INT8_TMP (line 44) | CREATE FOREIGN TABLE INT8_TMP(
type tenk1 (line 54) | CREATE FOREIGN TABLE tenk1 (
type parent_table (line 74) | CREATE TABLE parent_table (
type limit_thousand_v_1 (line 416) | CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_2 (line 421) | CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 426) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 429) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_4 (line 434) | CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousa...
FILE: sql/15.7/extra/prepare.sql
type tenk1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type road (line 31) | CREATE FOREIGN TABLE road (
type road_tmp (line 37) | create foreign table road_tmp (a int, b int, id int options (key 'true')
FILE: sql/15.7/extra/select.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type onek2 (line 31) | CREATE FOREIGN TABLE onek2 (
type INT8_TBL (line 51) | CREATE FOREIGN TABLE INT8_TBL(
type person (line 68) | CREATE FOREIGN TABLE person (
function sillysrf (line 364) | create function sillysrf(int) returns setof int as
type list_parted_tbl (line 385) | create table list_parted_tbl (a int,b int) partition by list (a)
type list_parted_tbl1 (line 387) | create table list_parted_tbl1 partition of list_parted_tbl
FILE: sql/15.7/extra/select_having.sql
type test_having (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/15.7/extra/sqlite_fdw_post.sql
type ft1 (line 75) | CREATE FOREIGN TABLE ft1 (
type ft2 (line 90) | CREATE FOREIGN TABLE ft2 (
type ft5 (line 105) | CREATE FOREIGN TABLE ft4 (
type ft2 (line 119) | CREATE FOREIGN TABLE ft6 (
type v4 (line 805) | CREATE VIEW v4 AS SELECT * FROM ft4
type v5 (line 807) | CREATE VIEW v5 AS SELECT * FROM ft5
function least_accum (line 1043) | create function least_accum(anyelement, variadic anyarray)
function f_test (line 1470) | CREATE OR REPLACE FUNCTION f_test(p_c1 int) RETURNS int AS $$
type reind_fdw_parent (line 1490) | CREATE FOREIGN TABLE reindex_foreign (c1 int, c2 int)
type ft3 (line 1581) | create foreign table ft3 (f1 text collate "C", f2 text, f3 varchar(10))
function "S 1" (line 1785) | CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$
type ft1_constraint (line 1811) | CREATE FOREIGN TABLE ft1_constraint (
function row_before_insupd_trigfunc (line 1972) | CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN ...
type foreign_tbl (line 1975) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type rw_view (line 1980) | CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
type foreign_tbl (line 2030) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type parent_tbl (line 2036) | CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a)
type rw_view (line 2046) | CREATE VIEW rw_view AS SELECT * FROM parent_tbl
type loc1 (line 2102) | create foreign table loc1 (f1 serial, f2 text, id integer options (key '...
type grem1 (line 2126) | create foreign table grem1 (
function trigger_func (line 2174) | CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS $$
function trigger_data (line 2189) | CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
function trig_null (line 2426) | CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$
type a (line 2615) | CREATE TABLE a (aa TEXT)
type foo (line 2689) | create table foo (f1 int, f2 int)
type bar (line 2691) | create foreign table foo2 (f3 int OPTIONS (key 'true')) inherits (foo)
type bar (line 2696) | create foreign table bar2 (f3 int OPTIONS (key 'true')) inherits (bar)
type foo2child (line 2740) | create foreign table foo2child (f3 int)
type i_foo_f1 (line 2809) | create index i_foo_f1 on foo(f1)
type parent (line 2883) | create table parent (a int, b text)
type "S 1" (line 3293) | CREATE FOREIGN TABLE tru_pk_ftable (id int)
type table30 (line 3961) | CREATE FOREIGN TABLE table30 ( x int )
type batch_size (line 3987) | CREATE FOREIGN TABLE ftable ( x int OPTIONS (key 'true') ) SERVER sqlite...
type batch_size (line 4019) | CREATE FOREIGN TABLE ftable ( x int ) SERVER sqlite_svr OPTIONS ( table ...
type inv_bsz (line 4430) | CREATE FOREIGN TABLE inv_bsz (c1 int )
FILE: sql/15.7/extra/update.sql
type update_test (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type upsert_test (line 19) | CREATE FOREIGN TABLE upsert_test (
FILE: sql/15.7/selectfunc.sql
type s3 (line 13) | CREATE FOREIGN TABLE s3(id text OPTIONS (key 'true')
FILE: sql/15.7/sqlite_fdw.sql
type department (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type employee (line 11) | CREATE FOREIGN TABLE employee(emp_id int OPTIONS (key 'true')
type empdata (line 13) | CREATE FOREIGN TABLE empdata(emp_id int OPTIONS (key 'true')
type numbers (line 15) | CREATE FOREIGN TABLE numbers(a int OPTIONS (key 'true')
type multiprimary (line 17) | CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true')
type noprimary (line 19) | CREATE FOREIGN TABLE noprimary(a int, b text)
type RO_RW_test (line 22) | CREATE FOREIGN TABLE RO_RW_test(i int OPTIONS (key 'true')
function test_param_WHERE (line 129) | create or replace function test_param_WHERE() returns void as $$
type columntest (line 511) | CREATE FOREIGN TABLE columntest(a int OPTIONS(column_name 'a a', key 'tr...
type fts_table (line 539) | CREATE FOREIGN TABLE fts_table (name text, description text)
type grem1_2 (line 585) | CREATE FOREIGN TABLE grem1_2 (
type case_exp (line 598) | CREATE FOREIGN TABLE case_exp(c1 int OPTIONS (key 'true')
FILE: sql/15.7/types/bitstring.sql
type "type_BIT" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_VARBIT" (line 45) | CREATE FOREIGN TABLE "type_VARBIT"( "i" int OPTIONS (key 'true'), "b" va...
FILE: sql/15.7/types/bool.sql
type "type_BOOLEAN" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_BOOLEANpk" (line 93) | CREATE FOREIGN TABLE "type_BOOLEANpk" (col bool OPTIONS (key 'true')
FILE: sql/15.7/types/float4.sql
type FLOAT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT4_TMP (line 12) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
function xfloat4in (line 436) | create function xfloat4in(cstring) returns xfloat4 immutable strict
function xfloat4out (line 439) | create function xfloat4out(xfloat4) returns cstring immutable strict
type testdata (line 459) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/15.7/types/float8.sql
type FLOAT8_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT8_TMP (line 12) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
function xfloat8in (line 879) | create function xfloat8in(cstring) returns xfloat8 immutable strict
function xfloat8out (line 882) | create function xfloat8out(xfloat8) returns cstring immutable strict
type testdata (line 902) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/15.7/types/int4.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 12) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type FLOAT8_TMP (line 268) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 286) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
FILE: sql/15.7/types/int8.sql
type INT8_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT8_TMP (line 16) | CREATE FOREIGN TABLE INT8_TMP(
type FLOAT8_TMP (line 528) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 546) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
FILE: sql/15.7/types/json.sql
type "type_JSON" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_JSONB" (line 21) | CREATE FOREIGN TABLE "type_JSONB" (
type "type_JSONB+" (line 32) | CREATE FOREIGN TABLE "type_JSONB+" (
type json_osm_test (line 804) | CREATE FOREIGN TABLE json_osm_test (
FILE: sql/15.7/types/numeric.sql
type num_data (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type num_exp_add (line 13) | CREATE FOREIGN TABLE num_exp_add (id1 int4 OPTIONS (key 'true')
type num_exp_sub (line 15) | CREATE FOREIGN TABLE num_exp_sub (id1 int4 OPTIONS (key 'true')
type num_exp_div (line 17) | CREATE FOREIGN TABLE num_exp_div (id1 int4 OPTIONS (key 'true')
type num_exp_mul (line 19) | CREATE FOREIGN TABLE num_exp_mul (id1 int4 OPTIONS (key 'true')
type num_exp_sqrt (line 21) | CREATE FOREIGN TABLE num_exp_sqrt (id int4 OPTIONS (key 'true')
type num_exp_ln (line 23) | CREATE FOREIGN TABLE num_exp_ln (id int4 OPTIONS (key 'true')
type num_exp_log10 (line 25) | CREATE FOREIGN TABLE num_exp_log10 (id int4 OPTIONS (key 'true')
type num_exp_power_10_ln (line 27) | CREATE FOREIGN TABLE num_exp_power_10_ln (id int4 OPTIONS (key 'true')
type num_variance (line 30) | CREATE FOREIGN TABLE num_variance (a numeric)
type num_result (line 33) | CREATE FOREIGN TABLE num_result (id1 int4 OPTIONS (key 'true')
type v (line 1148) | CREATE FOREIGN TABLE v (id int4 OPTIONS (key 'true')
type fract_only (line 1549) | CREATE FOREIGN TABLE fract_only (id int, val numeric(4,4))
type num_tmp (line 1583) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
type FLOAT8_TMP (line 1676) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type NUMERIC_TMP (line 1699) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, f2 numeric, id int OPTIONS ...
type FLOAT4_TMP (line 1722) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type ceil_floor_round (line 1837) | CREATE FOREIGN TABLE ceil_floor_round (a numeric OPTIONS (key 'true')
type INT4_TMP (line 1857) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type width_bucket_tbl (line 1876) | CREATE FOREIGN TABLE width_bucket_tbl (
type width_bucket_test (line 1956) | CREATE FOREIGN TABLE width_bucket_test (
type to_number_tbl (line 2199) | create foreign table to_number_tbl (a text, id int options (key 'true')
type num_input_test (line 2363) | CREATE FOREIGN TABLE num_input_test (n1 numeric)
type num_typemod_test (line 2421) | CREATE FOREIGN TABLE num_typemod_test (
type num_tmp (line 2472) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
FILE: sql/15.7/types/out_of_range.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 13) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type INT2_TBL (line 42) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type INT2_TMP (line 44) | CREATE FOREIGN TABLE INT2_TMP(f1 int2, f2 int2, id int OPTIONS (key 'true')
type INT8_TBL (line 73) | CREATE FOREIGN TABLE INT8_TBL(q1 int8 OPTIONS (key 'true')
FILE: sql/15.7/types/timestamp.sql
type dates1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type dates2 (line 18) | CREATE FOREIGN TABLE dates2 (
FILE: sql/15.7/types/uuid.sql
type "type_UUIDpk" (line 210) | CREATE FOREIGN TABLE "type_UUIDpk" (col uuid OPTIONS (key 'true')
FILE: sql/15.7/with_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/15.7/with_gis_support/postgis.sql
type "♂" (line 18) | CREATE TABLE "♂"."テスト" (
type "♁" (line 43) | CREATE TABLE "♁" (
type "types_PostGIS" (line 165) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 219) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 245) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/15.7/with_gis_support/type.sql
type "type_BOOLEAN" (line 144) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/15.7/without_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/15.7/without_gis_support/nogis.sql
type "types_PostGIS" (line 43) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 81) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 107) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/15.7/without_gis_support/type.sql
type "type_BOOLEAN" (line 141) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/16.3/aggregate.sql
type multiprimary (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type multiprimary (line 19) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type limittest (line 49) | CREATE FOREIGN TABLE limittest(id serial OPTIONS (key 'true')
FILE: sql/16.3/extra/aggregates.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type aggtest (line 30) | CREATE FOREIGN TABLE aggtest (
type student (line 36) | CREATE FOREIGN TABLE student (
type tenk1 (line 44) | CREATE FOREIGN TABLE tenk1 (
type INT8_TBL (line 64) | CREATE FOREIGN TABLE INT8_TBL(
type INT4_TBL (line 80) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type multi_arg_agg (line 93) | CREATE FOREIGN TABLE multi_arg_agg (a int OPTIONS (key 'true')
type VARCHAR_TBL (line 96) | CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')
type FLOAT8_TBL (line 99) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type agg_tb (line 112) | CREATE FOREIGN TABLE agg_tb(v int, id integer OPTIONS (key 'true')
type agg_tb2 (line 133) | CREATE FOREIGN TABLE agg_tb2(v text)
type agg_t3 (line 202) | CREATE FOREIGN TABLE agg_t3(a float8, b float8, id integer OPTIONS (key ...
type agg_t4 (line 236) | CREATE FOREIGN TABLE agg_t4(a float4, b float4, id integer OPTIONS (key ...
type agg_t5 (line 270) | CREATE FOREIGN TABLE agg_t5(a numeric, b numeric, id integer OPTIONS (ke...
type agg_t8 (line 310) | CREATE FOREIGN TABLE agg_t8(a text OPTIONS (key 'true')
type agg_t6 (line 409) | CREATE FOREIGN TABLE agg_t6(a float8, id integer OPTIONS (key 'true')
type agg_t7 (line 460) | CREATE FOREIGN TABLE agg_t7(a float8, b float8, c float8, d float8, id i...
type regr_test (line 484) | CREATE FOREIGN TABLE regr_test (x float8, y float8, id int options (key ...
type agg_t15 (line 506) | CREATE FOREIGN TABLE agg_t15 (a text, b int, c int, id int options (key ...
type agg_t16 (line 530) | CREATE FOREIGN TABLE agg_t16 (a text, b text, id int options (key 'true')
function sum3 (line 603) | create function sum3(int8,int8,int8) returns int8 as
type bitwise_test (line 679) | CREATE FOREIGN TABLE bitwise_test(
type bool_test_tmp (line 728) | CREATE FOREIGN TABLE bool_test_tmp(
type bool_test (line 800) | CREATE FOREIGN TABLE bool_test(
type minmaxtest (line 948) | create foreign table minmaxtest(f1 int)
type minmaxtest1 (line 950) | create table minmaxtest1() inherits (minmaxtest)
type minmaxtest2 (line 952) | create table minmaxtest2() inherits (minmaxtest)
type minmaxtest3 (line 954) | create table minmaxtest3() inherits (minmaxtest)
type minmaxtest1i (line 956) | create index minmaxtest1i on minmaxtest1(f1)
type minmaxtest2i (line 958) | create index minmaxtest2i on minmaxtest2(f1 desc)
type minmaxtest3i (line 960) | create index minmaxtest3i on minmaxtest3(f1) where f1 is not null
type agg_t1 (line 998) | create foreign table agg_t1 (a int OPTIONS (key 'true')
type agg_t2 (line 1000) | create foreign table agg_t2 (x int OPTIONS (key 'true')
type agg_t9 (line 1002) | create foreign table agg_t9 (a int OPTIONS (key 'true')
type t1c (line 1029) | create temp table t1c () inherits (agg_t1)
type t1 (line 1062) | create foreign table t1(f1 int, f2 int)
type t2 (line 1064) | create foreign table t2(f1 bigint, f2 oid)
function aggf_trans (line 1206) | create function aggf_trans(aggtype[],integer,integer,text) returns aggty...
function aggfns_trans (line 1211) | create function aggfns_trans(aggtype[],integer,integer,text) returns agg...
type agg_view1 (line 1259) | create view agg_view1 as
type agg_view1 (line 1268) | create or replace view agg_view1 as
type agg_view1 (line 1277) | create or replace view agg_view1 as
type agg_view1 (line 1286) | create or replace view agg_view1 as
type agg_view1 (line 1295) | create or replace view agg_view1 as
type agg_view1 (line 1304) | create or replace view agg_view1 as
type agg_view1 (line 1313) | create or replace view agg_view1 as
type bytea_test_table (line 1381) | create foreign table bytea_test_table(v bytea)
type pagg_test (line 1407) | create foreign table pagg_test (x int, y int)
type v_pagg_test (line 1422) | create view v_pagg_test AS
type agg_t17 (line 1495) | create foreign table agg_t17(foo text, bar text)
type agg_t170 (line 1504) | create foreign table agg_t170(v int)
type agg_t18 (line 1512) | create foreign table agg_t18 (inner_c int)
type agg_t19 (line 1514) | create foreign table agg_t19 (outer_c int)
type agg_t21 (line 1664) | create foreign table agg_t21 (x int)
type agg_t20 (line 1677) | create foreign table agg_t20 (x text)
type aggordview1 (line 1807) | create view aggordview1 as
function least_accum (line 1824) | create function least_accum(anyelement, variadic anyarray)
function cleast_accum (line 1834) | create function cleast_accum(anycompatible, variadic anycompatiblearray)
type agg_t10 (line 1858) | create foreign table agg_t10(one int, id int options (key 'true')
type agg_t11 (line 1860) | create foreign table agg_t11(one int, two int, id int options (key 'true')
type agg_t12 (line 1862) | create foreign table agg_t12(a int, id int options (key 'true')
function avg_transfn (line 1869) | create or replace function avg_transfn(state avg_state, n int) returns a...
function avg_finalfn (line 1892) | create function avg_finalfn(state avg_state) returns int4 as
function sum_finalfn (line 1904) | create function sum_finalfn(state avg_state) returns int4 as
function sum_transfn (line 2043) | create or replace function sum_transfn(state int4, n int4) returns int4 as
function halfsum_finalfn (line 2064) | create function halfsum_finalfn(state int4) returns int4 as
function balkifnull (line 2107) | CREATE FUNCTION balkifnull(int8, int4)
function balkifnull (line 2137) | CREATE FUNCTION balkifnull(int8, int8)
function rwagg_sfunc (line 2174) | CREATE FUNCTION rwagg_sfunc(x anyarray, y anyarray) RETURNS anyarray
function rwagg_finalfunc (line 2182) | CREATE FUNCTION rwagg_finalfunc(x anyarray) RETURNS anyarray
function eatarray (line 2201) | CREATE FUNCTION eatarray(x real[]) RETURNS real[]
type float_tb (line 2210) | CREATE FOREIGN TABLE float_tb(f real)
type agg_t13 (line 2274) | create foreign table agg_t13(x int, id int options (key 'true')
type agg_t14 (line 2287) | create foreign table agg_t14(x int, y int, id int options (key 'true')
type agg_data_2k (line 2353) | create foreign table agg_data_2k(g int, id int options (key 'true')
type agg_data_20k (line 2355) | create foreign table agg_data_20k(g int, id int options (key 'true')
type agg_group_1 (line 2358) | create foreign table agg_group_1(c1 int, c2 numeric, c3 int)
type agg_group_2 (line 2360) | create foreign table agg_group_2(a int, c1 numeric, c2 text, c3 int)
type agg_group_3 (line 2362) | create foreign table agg_group_3(c1 numeric, c2 int4, c3 int)
type agg_group_4 (line 2364) | create foreign table agg_group_4(c1 numeric, c2 text, c3 int)
type agg_hash_1 (line 2367) | create foreign table agg_hash_1(c1 int, c2 numeric, c3 int)
type agg_hash_2 (line 2369) | create foreign table agg_hash_2(a int, c1 numeric, c2 text, c3 int)
type agg_hash_3 (line 2371) | create foreign table agg_hash_3(c1 numeric, c2 int4, c3 int)
type agg_hash_4 (line 2373) | create foreign table agg_hash_4(c1 numeric, c2 text, c3 int)
FILE: sql/16.3/extra/encodings.sql
type "Unicode data" (line 42) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 54) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 191) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 328) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 465) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 602) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 739) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 876) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1013) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1150) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1287) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1424) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1561) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1698) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1835) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1972) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2109) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2246) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2383) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2520) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2657) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2794) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2931) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3068) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3205) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3343) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3480) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/16.3/extra/insert.sql
type inserttest01 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/16.3/extra/join.sql
type J1_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type J2_TBL (line 19) | CREATE FOREIGN TABLE J2_TBL (
type tenk1 (line 25) | CREATE FOREIGN TABLE tenk1 (
type tenk2 (line 45) | CREATE FOREIGN TABLE tenk2 (
type INT4_TBL (line 65) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type FLOAT8_TBL (line 78) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type INT8_TBL (line 91) | CREATE FOREIGN TABLE INT8_TBL(
type INT2_TBL (line 107) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type onerow (line 153) | create temp table onerow();
type t31 (line 401) | CREATE FOREIGN TABLE t31 (name TEXT, n INTEGER)
type onek (line 404) | CREATE FOREIGN TABLE onek (
type t32 (line 892) | CREATE FOREIGN TABLE t32 (x int OPTIONS (key 'true')
type t2a (line 929) | create temp table t2a () inherits (t22)
type tt1 (line 977) | CREATE FOREIGN TABLE tt1 ( tt1_id int4, joincol int4 )
type tt2 (line 984) | CREATE FOREIGN TABLE tt2 ( tt2_id int4, joincol int4 )
type tt3 (line 1039) | create foreign table tt3(f1 int, f2 text)
type tt4 (line 1044) | create foreign table tt4(f1 int)
type tt4x (line 1111) | create foreign table tt4x(c1 int, c2 int, c3 int)
type tt5 (line 1130) | create foreign table tt5(f1 int, f2 int)
type tt6 (line 1132) | create foreign table tt6(f1 int, f2 int)
type xx (line 1154) | create foreign table xx (pkxx int)
type yy (line 1156) | create foreign table yy (pkyy int, pkxx int)
type zt1 (line 1186) | create foreign table zt1 (f1 int OPTIONS(key 'true')
type zt2 (line 1188) | create foreign table zt2 (f2 int OPTIONS(key 'true')
type zt3 (line 1190) | create foreign table zt3 (f3 int OPTIONS(key 'true')
type zv1 (line 1203) | create temp view zv1 as select *,'dummy'::text AS junk from zt1
type a1 (line 1252) | create foreign table a1 (i integer)
type b1 (line 1254) | create foreign table b1 (x integer, y integer)
type a2 (line 1312) | create foreign table a2 (
type b2 (line 1316) | create foreign table b2 (
type c2 (line 1321) | create foreign table c2 (
type sub_tbl (line 1359) | create foreign table sub_tbl (key1 int, key3 int, key5 int, key6 int, va...
type nt1 (line 1426) | create foreign table nt1 (
type nt2 (line 1432) | create foreign table nt2 (
type nt3 (line 1439) | create foreign table nt3 (
type q1 (line 1555) | create foreign table q1(i int)
type q2 (line 1559) | create foreign table q2(i int)
function f_immutable_int4 (line 1739) | create function f_immutable_int4(i integer) returns integer as
function mki8 (line 1808) | create function mki8(bigint, bigint) returns int8_tbl as
function mki4 (line 1812) | create function mki4(int) returns int4_tbl as
type text_tbl (line 2046) | create foreign table text_tbl(f1 text)
type t (line 2254) | CREATE FOREIGN TABLE t (a int options (key 'true')
type a3 (line 2433) | CREATE FOREIGN TABLE a3 (id int OPTIONS (key 'true')
type b3 (line 2435) | CREATE FOREIGN TABLE b3 (id int OPTIONS (key 'true')
type c3 (line 2437) | CREATE FOREIGN TABLE c3 (id int OPTIONS (key 'true')
type d3 (line 2439) | CREATE FOREIGN TABLE d3 (a int, b int)
type parted_b1 (line 2630) | CREATE TEMP TABLE parted_b1 partition of parted_b for values from (0) to...
type parent (line 2640) | create foreign table parent (k int options (key 'true')
type child (line 2642) | create foreign table child (k int options (key 'true')
type a4 (line 2691) | CREATE FOREIGN TABLE a4 (id int OPTIONS (key 'true')
type b4 (line 2693) | CREATE FOREIGN TABLE b4 (id int OPTIONS (key 'true')
type innertab (line 2710) | create foreign table innertab (id int8 options (key 'true')
type xx1 (line 3283) | create temp table xx1 as select f1 as x1, -f1 as x2 from int4_tbl
type fkest (line 3336) | create table fkest (x integer, x10 integer, x10b integer, x100 integer)
type fkest (line 3340) | create unique index on fkest(x, x10, x100)
type fkest (line 3370) | create foreign table fkest (a int options (key 'true')
type fkest1 (line 3372) | create foreign table fkest1 (a int options (key 'true')
type j11 (line 3401) | create foreign table j11 (id int options (key 'true')
type j21 (line 3403) | create foreign table j21 (id int options (key 'true')
type j31 (line 3405) | create foreign table j31 (id int)
type j32 (line 3477) | create foreign table j32 (id1 int options (key 'true')
type j1 (line 3519) | create table j1 (id1 int, id2 int, primary key(id1,id2))
type j2 (line 3521) | create table j2 (id1 int, id2 int, primary key(id1,id2))
type j1_id2_idx (line 3532) | create unique index j1_id2_idx on j1(id2) where id2 is not null
type j3 (line 3620) | create table j3 as select unique1, tenthous from onek
type j3 (line 3623) | create unique index on j3(unique1, tenthous)
FILE: sql/16.3/extra/limit.sql
type onek (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type int8_tbl (line 31) | CREATE FOREIGN TABLE int8_tbl(q1 int8 OPTIONS (key 'true')
type INT8_TMP (line 44) | CREATE FOREIGN TABLE INT8_TMP(
type tenk1 (line 54) | CREATE FOREIGN TABLE tenk1 (
type parent_table (line 74) | CREATE TABLE parent_table (
type limit_thousand_v_1 (line 416) | CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_2 (line 421) | CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 426) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 429) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_4 (line 434) | CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousa...
FILE: sql/16.3/extra/prepare.sql
type tenk1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type road (line 31) | CREATE FOREIGN TABLE road (
type road_tmp (line 37) | create foreign table road_tmp (a int, b int, id int options (key 'true')
FILE: sql/16.3/extra/select.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type onek2 (line 31) | CREATE FOREIGN TABLE onek2 (
type INT8_TBL (line 51) | CREATE FOREIGN TABLE INT8_TBL(
type person (line 67) | CREATE FOREIGN TABLE person (
function sillysrf (line 363) | create function sillysrf(int) returns setof int as
type list_parted_tbl (line 384) | create table list_parted_tbl (a int,b int) partition by list (a)
type list_parted_tbl1 (line 386) | create table list_parted_tbl1 partition of list_parted_tbl
FILE: sql/16.3/extra/select_having.sql
type test_having (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/16.3/extra/sqlite_fdw_post.sql
type ft1 (line 75) | CREATE FOREIGN TABLE ft1 (
type ft2 (line 90) | CREATE FOREIGN TABLE ft2 (
type ft5 (line 105) | CREATE FOREIGN TABLE ft4 (
type ft2 (line 119) | CREATE FOREIGN TABLE ft6 (
type v4 (line 821) | CREATE VIEW v4 AS SELECT * FROM ft4
type v5 (line 823) | CREATE VIEW v5 AS SELECT * FROM ft5
function least_accum (line 1087) | create function least_accum(anyelement, variadic anyarray)
function f_test (line 1514) | CREATE OR REPLACE FUNCTION f_test(p_c1 int) RETURNS int AS $$
type reind_fdw_parent (line 1534) | CREATE FOREIGN TABLE reindex_foreign (c1 int, c2 int)
type ft3 (line 1625) | create foreign table ft3 (f1 text collate "C", f2 text, f3 varchar(10))
function "S 1" (line 1829) | CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$
type ft1_constraint (line 1855) | CREATE FOREIGN TABLE ft1_constraint (
function row_before_insupd_trigfunc (line 2016) | CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN ...
type foreign_tbl (line 2019) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type rw_view (line 2024) | CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
type foreign_tbl (line 2074) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type parent_tbl (line 2080) | CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a)
type rw_view (line 2090) | CREATE VIEW rw_view AS SELECT * FROM parent_tbl
type loc1 (line 2170) | create foreign table loc1 (f1 serial, f2 text, id integer options (key '...
type grem1 (line 2194) | create foreign table grem1 (
function trigger_func (line 2261) | CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS $$
function trigger_data (line 2276) | CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
function trig_null (line 2514) | CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$
type a (line 2703) | CREATE TABLE a (aa TEXT)
type foo (line 2777) | create table foo (f1 int, f2 int)
type bar (line 2779) | create foreign table foo2 (f3 int OPTIONS (key 'true')) inherits (foo)
type bar (line 2784) | create foreign table bar2 (f3 int OPTIONS (key 'true')) inherits (bar)
type foo2child (line 2828) | create foreign table foo2child (f3 int)
type i_foo_f1 (line 2897) | create index i_foo_f1 on foo(f1)
type parent (line 2971) | create table parent (a int, b text)
type "S 1" (line 3485) | CREATE FOREIGN TABLE tru_pk_ftable (id int)
type table30 (line 4149) | CREATE FOREIGN TABLE table30 ( x int )
type batch_size (line 4175) | CREATE FOREIGN TABLE ftable ( x int OPTIONS (key 'true') ) SERVER sqlite...
type batch_size (line 4195) | CREATE FOREIGN TABLE ftable ( x int ) SERVER sqlite_svr OPTIONS ( table ...
type inv_bsz (line 4727) | CREATE FOREIGN TABLE inv_bsz (c1 int )
FILE: sql/16.3/extra/update.sql
type update_test (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type upsert_test (line 19) | CREATE FOREIGN TABLE upsert_test (
FILE: sql/16.3/selectfunc.sql
type s3 (line 13) | CREATE FOREIGN TABLE s3(id text OPTIONS (key 'true')
FILE: sql/16.3/sqlite_fdw.sql
type department (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type employee (line 11) | CREATE FOREIGN TABLE employee(emp_id int OPTIONS (key 'true')
type empdata (line 13) | CREATE FOREIGN TABLE empdata(emp_id int OPTIONS (key 'true')
type numbers (line 15) | CREATE FOREIGN TABLE numbers(a int OPTIONS (key 'true')
type multiprimary (line 17) | CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true')
type noprimary (line 19) | CREATE FOREIGN TABLE noprimary(a int, b text)
type RO_RW_test (line 21) | CREATE FOREIGN TABLE RO_RW_test(i int OPTIONS (key 'true')
function test_param_WHERE (line 128) | create or replace function test_param_WHERE() returns void as $$
type columntest (line 510) | CREATE FOREIGN TABLE columntest(a int OPTIONS(column_name 'a a', key 'tr...
type fts_table (line 538) | CREATE FOREIGN TABLE fts_table (name text, description text)
type grem1_2 (line 584) | CREATE FOREIGN TABLE grem1_2 (
type case_exp (line 597) | CREATE FOREIGN TABLE case_exp(c1 int OPTIONS (key 'true')
FILE: sql/16.3/types/bitstring.sql
type "type_BIT" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_VARBIT" (line 45) | CREATE FOREIGN TABLE "type_VARBIT"( "i" int OPTIONS (key 'true'), "b" va...
FILE: sql/16.3/types/bool.sql
type "type_BOOLEAN" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_BOOLEANpk" (line 93) | CREATE FOREIGN TABLE "type_BOOLEANpk" (col bool OPTIONS (key 'true')
FILE: sql/16.3/types/float4.sql
type FLOAT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT4_TMP (line 12) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type NON_ERROR_THROWING_API_FLOAT4 (line 72) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_FLOAT4(f1 text, id serial OP...
function xfloat4in (line 445) | create function xfloat4in(cstring) returns xfloat4 immutable strict
function xfloat4out (line 448) | create function xfloat4out(xfloat4) returns cstring immutable strict
type testdata (line 468) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/16.3/types/float8.sql
type FLOAT8_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT8_TMP (line 12) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type NON_ERROR_THROWING_API_FLOAT8 (line 60) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_FLOAT8(f1 text, id serial OP...
function xfloat8in (line 904) | create function xfloat8in(cstring) returns xfloat8 immutable strict
function xfloat8out (line 907) | create function xfloat8out(xfloat8) returns cstring immutable strict
type testdata (line 927) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/16.3/types/int4.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 12) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type NON_ERROR_THROWING_API_INT4 (line 55) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_INT4(f1 text, id serial OPTI...
type FLOAT8_TMP (line 282) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 300) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
type special_case_int4 (line 374) | CREATE FOREIGN TABLE special_case_int4 (f1 text, id int OPTIONS (key 'tr...
FILE: sql/16.3/types/int8.sql
type INT8_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT8_TMP (line 16) | CREATE FOREIGN TABLE INT8_TMP(
type NON_ERROR_THROWING_API_INT8 (line 57) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_INT8(f1 text, id serial OPTI...
type FLOAT8_TMP (line 542) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 560) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
type special_case_int8 (line 635) | CREATE FOREIGN TABLE special_case_int8 (f1 text, id int OPTIONS (key 'tr...
FILE: sql/16.3/types/json.sql
type "type_JSON" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_JSONB" (line 21) | CREATE FOREIGN TABLE "type_JSONB" (
type "type_JSONB+" (line 32) | CREATE FOREIGN TABLE "type_JSONB+" (
type json_osm_test (line 804) | CREATE FOREIGN TABLE json_osm_test (
FILE: sql/16.3/types/numeric.sql
type num_data (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type num_exp_add (line 13) | CREATE FOREIGN TABLE num_exp_add (id1 int4 OPTIONS (key 'true')
type num_exp_sub (line 15) | CREATE FOREIGN TABLE num_exp_sub (id1 int4 OPTIONS (key 'true')
type num_exp_div (line 17) | CREATE FOREIGN TABLE num_exp_div (id1 int4 OPTIONS (key 'true')
type num_exp_mul (line 19) | CREATE FOREIGN TABLE num_exp_mul (id1 int4 OPTIONS (key 'true')
type num_exp_sqrt (line 21) | CREATE FOREIGN TABLE num_exp_sqrt (id int4 OPTIONS (key 'true')
type num_exp_ln (line 23) | CREATE FOREIGN TABLE num_exp_ln (id int4 OPTIONS (key 'true')
type num_exp_log10 (line 25) | CREATE FOREIGN TABLE num_exp_log10 (id int4 OPTIONS (key 'true')
type num_exp_power_10_ln (line 27) | CREATE FOREIGN TABLE num_exp_power_10_ln (id int4 OPTIONS (key 'true')
type num_variance (line 30) | CREATE FOREIGN TABLE num_variance (a numeric)
type num_result (line 33) | CREATE FOREIGN TABLE num_result (id1 int4 OPTIONS (key 'true')
type v (line 1148) | CREATE FOREIGN TABLE v (id int4 OPTIONS (key 'true')
type fract_only (line 1549) | CREATE FOREIGN TABLE fract_only (id int, val numeric(4,4))
type num_tmp (line 1583) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
type FLOAT8_TMP (line 1676) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type NUMERIC_TMP (line 1699) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, f2 numeric, id int OPTIONS ...
type FLOAT4_TMP (line 1722) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type ceil_floor_round (line 1837) | CREATE FOREIGN TABLE ceil_floor_round (a numeric OPTIONS (key 'true')
type INT4_TMP (line 1857) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type width_bucket_tbl (line 1876) | CREATE FOREIGN TABLE width_bucket_tbl (
type width_bucket_test (line 1956) | CREATE FOREIGN TABLE width_bucket_test (
type ceil_round_float8 (line 2213) | CREATE FOREIGN TABLE ceil_round_float8(a float8)
type to_number_tbl (line 2242) | create foreign table to_number_tbl (a text, id int options (key 'true')
type num_input_test (line 2406) | CREATE FOREIGN TABLE num_input_test (n1 numeric)
type NON_ERROR_THROWING_API_INT4_NUMERIC (line 2489) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_INT4_NUMERIC(f1 text, id ser...
type num_typemod_test (line 2507) | CREATE FOREIGN TABLE num_typemod_test (
type num_tmp (line 2558) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
FILE: sql/16.3/types/out_of_range.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 13) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type INT2_TBL (line 42) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type INT2_TMP (line 44) | CREATE FOREIGN TABLE INT2_TMP(f1 int2, f2 int2, id int OPTIONS (key 'true')
type INT8_TBL (line 73) | CREATE FOREIGN TABLE INT8_TBL(q1 int8 OPTIONS (key 'true')
FILE: sql/16.3/types/timestamp.sql
type dates1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type dates2 (line 18) | CREATE FOREIGN TABLE dates2 (
FILE: sql/16.3/types/uuid.sql
type "type_UUIDpk" (line 210) | CREATE FOREIGN TABLE "type_UUIDpk" (col uuid OPTIONS (key 'true')
FILE: sql/16.3/with_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/16.3/with_gis_support/postgis.sql
type "♂" (line 18) | CREATE TABLE "♂"."テスト" (
type "♁" (line 43) | CREATE TABLE "♁" (
type "types_PostGIS" (line 165) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 219) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 245) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/16.3/with_gis_support/type.sql
type "type_BOOLEAN" (line 144) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/16.3/without_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/16.3/without_gis_support/nogis.sql
type "types_PostGIS" (line 43) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 81) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 107) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/16.3/without_gis_support/type.sql
type "type_BOOLEAN" (line 141) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/17.0/aggregate.sql
type multiprimary (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type multiprimary (line 19) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type limittest (line 49) | CREATE FOREIGN TABLE limittest(id serial OPTIONS (key 'true')
FILE: sql/17.0/extra/aggregates.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type aggtest (line 30) | CREATE FOREIGN TABLE aggtest (
type student (line 36) | CREATE FOREIGN TABLE student (
type tenk1 (line 44) | CREATE FOREIGN TABLE tenk1 (
type INT8_TBL (line 64) | CREATE FOREIGN TABLE INT8_TBL(
type INT4_TBL (line 80) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type multi_arg_agg (line 93) | CREATE FOREIGN TABLE multi_arg_agg (a int OPTIONS (key 'true')
type VARCHAR_TBL (line 96) | CREATE FOREIGN TABLE VARCHAR_TBL(f1 varchar(4) OPTIONS (key 'true')
type FLOAT8_TBL (line 99) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type agg_tb (line 112) | CREATE FOREIGN TABLE agg_tb(v int, id integer OPTIONS (key 'true')
type agg_tb2 (line 133) | CREATE FOREIGN TABLE agg_tb2(v text)
type agg_t3 (line 202) | CREATE FOREIGN TABLE agg_t3(a float8, b float8, id integer OPTIONS (key ...
type agg_t4 (line 236) | CREATE FOREIGN TABLE agg_t4(a float4, b float4, id integer OPTIONS (key ...
type agg_t5 (line 270) | CREATE FOREIGN TABLE agg_t5(a numeric, b numeric, id integer OPTIONS (ke...
type agg_t8 (line 310) | CREATE FOREIGN TABLE agg_t8(a text OPTIONS (key 'true')
type agg_t6 (line 409) | CREATE FOREIGN TABLE agg_t6(a float8, id integer OPTIONS (key 'true')
type agg_t7 (line 460) | CREATE FOREIGN TABLE agg_t7(a float8, b float8, c float8, d float8, id i...
type regr_test (line 484) | CREATE FOREIGN TABLE regr_test (x float8, y float8, id int options (key ...
type agg_t15 (line 506) | CREATE FOREIGN TABLE agg_t15 (a text, b int, c int, id int options (key ...
type agg_t16 (line 530) | CREATE FOREIGN TABLE agg_t16 (a text, b text, id int options (key 'true')
function sum3 (line 603) | create function sum3(int8,int8,int8) returns int8 as
type bitwise_test (line 679) | CREATE FOREIGN TABLE bitwise_test(
type bool_test_tmp (line 728) | CREATE FOREIGN TABLE bool_test_tmp(
type bool_test (line 800) | CREATE FOREIGN TABLE bool_test(
type minmaxtest (line 948) | create foreign table minmaxtest(f1 int)
type minmaxtest1 (line 950) | create table minmaxtest1() inherits (minmaxtest)
type minmaxtest2 (line 952) | create table minmaxtest2() inherits (minmaxtest)
type minmaxtest3 (line 954) | create table minmaxtest3() inherits (minmaxtest)
type minmaxtest1i (line 956) | create index minmaxtest1i on minmaxtest1(f1)
type minmaxtest2i (line 958) | create index minmaxtest2i on minmaxtest2(f1 desc)
type minmaxtest3i (line 960) | create index minmaxtest3i on minmaxtest3(f1) where f1 is not null
type agg_t1 (line 1010) | create foreign table agg_t1 (a int OPTIONS (key 'true')
type agg_t2 (line 1012) | create foreign table agg_t2 (x int OPTIONS (key 'true')
type agg_t9 (line 1014) | create foreign table agg_t9 (a int OPTIONS (key 'true')
type t1c (line 1041) | create temp table t1c () inherits (agg_t1)
type t1 (line 1074) | create foreign table t1(f1 int, f2 int)
type t2 (line 1076) | create foreign table t2(f1 bigint, f2 oid)
function aggf_trans (line 1218) | create function aggf_trans(aggtype[],integer,integer,text) returns aggty...
function aggfns_trans (line 1223) | create function aggfns_trans(aggtype[],integer,integer,text) returns agg...
type agg_t22 (line 1270) | create foreign table agg_t22 (c1 text, id int)
type agg_t23 (line 1272) | create foreign table agg_t23 (id int)
type agg_view1 (line 1289) | create view agg_view1 as
type agg_view1 (line 1298) | create or replace view agg_view1 as
type agg_view1 (line 1307) | create or replace view agg_view1 as
type agg_view1 (line 1316) | create or replace view agg_view1 as
type agg_view1 (line 1325) | create or replace view agg_view1 as
type agg_view1 (line 1334) | create or replace view agg_view1 as
type agg_view1 (line 1343) | create or replace view agg_view1 as
type bytea_test_table (line 1411) | create foreign table bytea_test_table(v bytea)
type pagg_test (line 1437) | create foreign table pagg_test (x int, y int)
type v_pagg_test (line 1452) | create view v_pagg_test AS
type agg_t17 (line 1525) | create foreign table agg_t17(foo text, bar text)
type agg_t170 (line 1534) | create foreign table agg_t170(v int)
type agg_t18 (line 1542) | create foreign table agg_t18 (inner_c int)
type agg_t19 (line 1544) | create foreign table agg_t19 (outer_c int)
type agg_t21 (line 1694) | create foreign table agg_t21 (x int)
type agg_t20 (line 1707) | create foreign table agg_t20 (x text)
type aggordview1 (line 1837) | create view aggordview1 as
function least_accum (line 1854) | create function least_accum(anyelement, variadic anyarray)
function cleast_accum (line 1864) | create function cleast_accum(anycompatible, variadic anycompatiblearray)
type agg_t10 (line 1888) | create foreign table agg_t10(one int, id int options (key 'true')
type agg_t11 (line 1890) | create foreign table agg_t11(one int, two int, id int options (key 'true')
type agg_t12 (line 1892) | create foreign table agg_t12(a int, id int options (key 'true')
function avg_transfn (line 1899) | create or replace function avg_transfn(state avg_state, n int) returns a...
function avg_finalfn (line 1922) | create function avg_finalfn(state avg_state) returns int4 as
function sum_finalfn (line 1934) | create function sum_finalfn(state avg_state) returns int4 as
function sum_transfn (line 2073) | create or replace function sum_transfn(state int4, n int4) returns int4 as
function halfsum_finalfn (line 2094) | create function halfsum_finalfn(state int4) returns int4 as
function balkifnull (line 2137) | CREATE FUNCTION balkifnull(int8, int4)
type group_agg_pk (line 2231) | CREATE FOREIGN TABLE group_agg_pk(x int, y int, z int, w int, f int)
function rwagg_sfunc (line 2337) | CREATE FUNCTION rwagg_sfunc(x anyarray, y anyarray) RETURNS anyarray
function rwagg_finalfunc (line 2345) | CREATE FUNCTION rwagg_finalfunc(x anyarray) RETURNS anyarray
function eatarray (line 2364) | CREATE FUNCTION eatarray(x real[]) RETURNS real[]
type float_tb (line 2373) | CREATE FOREIGN TABLE float_tb(f real)
type agg_t13 (line 2437) | create foreign table agg_t13(x int, id int options (key 'true')
type agg_t14 (line 2450) | create foreign table agg_t14(x int, y int, id int options (key 'true')
type agg_data_2k (line 2516) | create foreign table agg_data_2k(g int, id int options (key 'true')
type agg_data_20k (line 2518) | create foreign table agg_data_20k(g int, id int options (key 'true')
type agg_group_1 (line 2521) | create foreign table agg_group_1(c1 int, c2 numeric, c3 int)
type agg_group_2 (line 2523) | create foreign table agg_group_2(a int, c1 numeric, c2 text, c3 int)
type agg_group_3 (line 2525) | create foreign table agg_group_3(c1 numeric, c2 int4, c3 int)
type agg_group_4 (line 2527) | create foreign table agg_group_4(c1 numeric, c2 text, c3 int)
type agg_hash_1 (line 2530) | create foreign table agg_hash_1(c1 int, c2 numeric, c3 int)
type agg_hash_2 (line 2532) | create foreign table agg_hash_2(a int, c1 numeric, c2 text, c3 int)
type agg_hash_3 (line 2534) | create foreign table agg_hash_3(c1 numeric, c2 int4, c3 int)
type agg_hash_4 (line 2536) | create foreign table agg_hash_4(c1 numeric, c2 text, c3 int)
FILE: sql/17.0/extra/encodings.sql
type "Unicode data" (line 42) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 54) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 191) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 328) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 465) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 602) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 739) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 876) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1013) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1150) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1287) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1424) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1561) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1698) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1835) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 1972) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2109) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2246) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2383) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2520) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2657) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2794) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 2931) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3068) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3205) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3343) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "Unicode data" (line 3480) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/17.0/extra/insert.sql
type inserttest01 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/17.0/extra/join.sql
type J1_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type J2_TBL (line 19) | CREATE FOREIGN TABLE J2_TBL (
type tenk1 (line 25) | CREATE FOREIGN TABLE tenk1 (
type tenk2 (line 45) | CREATE FOREIGN TABLE tenk2 (
type INT4_TBL (line 65) | CREATE FOREIGN TABLE INT4_TBL(f1 int4 OPTIONS (key 'true')
type FLOAT8_TBL (line 79) | CREATE FOREIGN TABLE FLOAT8_TBL(f1 float8 OPTIONS (key 'true')
type INT8_TBL (line 93) | CREATE FOREIGN TABLE INT8_TBL(
type INT2_TBL (line 108) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type onerow (line 154) | create temp table onerow();
type t31 (line 402) | CREATE FOREIGN TABLE t31 (name TEXT, n INTEGER)
type onek (line 405) | CREATE FOREIGN TABLE onek (
type t32 (line 893) | CREATE FOREIGN TABLE t32 (x int OPTIONS (key 'true')
type t2a (line 930) | create temp table t2a () inherits (t22)
type tt1 (line 978) | CREATE FOREIGN TABLE tt1 ( tt1_id int4, joincol int4 )
type tt2 (line 985) | CREATE FOREIGN TABLE tt2 ( tt2_id int4, joincol int4 )
type tbl_ra (line 1014) | create foreign table tbl_ra(a int options (key 'true')
type tt3 (line 1071) | create foreign table tt3(f1 int, f2 text)
type tt4 (line 1076) | create foreign table tt4(f1 int)
type tt4x (line 1143) | create foreign table tt4x(c1 int, c2 int, c3 int)
type tt5 (line 1162) | create foreign table tt5(f1 int, f2 int)
type tt6 (line 1164) | create foreign table tt6(f1 int, f2 int)
type xx (line 1186) | create foreign table xx (pkxx int)
type yy (line 1188) | create foreign table yy (pkyy int, pkxx int)
type zt1 (line 1218) | create foreign table zt1 (f1 int OPTIONS(key 'true')
type zt2 (line 1220) | create foreign table zt2 (f2 int OPTIONS(key 'true')
type zt3 (line 1222) | create foreign table zt3 (f3 int OPTIONS(key 'true')
type zv1 (line 1235) | create temp view zv1 as select *,'dummy'::text AS junk from zt1
type a1 (line 1284) | create foreign table a1 (i integer)
type b1 (line 1286) | create foreign table b1 (x integer, y integer)
type a2 (line 1344) | create foreign table a2 (
type b2 (line 1348) | create foreign table b2 (
type c2 (line 1353) | create foreign table c2 (
type sub_tbl (line 1391) | create foreign table sub_tbl (key1 int, key3 int, key5 int, key6 int, va...
type nt1 (line 1458) | create foreign table nt1 (
type nt2 (line 1464) | create foreign table nt2 (
type nt3 (line 1471) | create foreign table nt3 (
type q1 (line 1587) | create foreign table q1(i int)
type q2 (line 1591) | create foreign table q2(i int)
function f_immutable_int4 (line 1771) | create function f_immutable_int4(i integer) returns integer as
function mki8 (line 1840) | create function mki8(bigint, bigint) returns int8_tbl as
function mki4 (line 1844) | create function mki4(int) returns int4_tbl as
function f_field_select (line 1867) | create function f_field_select(t onek) returns int4 as
type text_tbl (line 2093) | create foreign table text_tbl(f1 text)
type t (line 2301) | CREATE FOREIGN TABLE t (a int options (key 'true')
type a3 (line 2480) | CREATE FOREIGN TABLE a3 (id int OPTIONS (key 'true')
type b3 (line 2482) | CREATE FOREIGN TABLE b3 (id int OPTIONS (key 'true')
type c3 (line 2484) | CREATE FOREIGN TABLE c3 (id int OPTIONS (key 'true')
type d3 (line 2486) | CREATE FOREIGN TABLE d3 (a int, b int)
type parted_b1 (line 2677) | CREATE TEMP TABLE parted_b1 partition of parted_b for values from (0) to...
type parent (line 2687) | create foreign table parent (k int options (key 'true')
type child (line 2689) | create foreign table child (k int options (key 'true')
type a4 (line 2738) | CREATE FOREIGN TABLE a4 (id int OPTIONS (key 'true')
type b4 (line 2740) | CREATE FOREIGN TABLE b4 (id int OPTIONS (key 'true')
type innertab (line 2757) | create foreign table innertab (id int8 options (key 'true')
type xx1 (line 3344) | create temp table xx1 as select f1 as x1, -f1 as x2 from int4_tbl
type fkest (line 3397) | create table fkest (x integer, x10 integer, x10b integer, x100 integer)
type fkest (line 3401) | create unique index on fkest(x, x10, x100)
type fkest (line 3431) | create foreign table fkest (a int options (key 'true')
type fkest1 (line 3433) | create foreign table fkest1 (a int options (key 'true')
type j11 (line 3462) | create foreign table j11 (id int options (key 'true')
type j21 (line 3464) | create foreign table j21 (id int options (key 'true')
type j31 (line 3466) | create foreign table j31 (id int)
type j32 (line 3538) | create foreign table j32 (id1 int options (key 'true')
type j1 (line 3580) | create table j1 (id1 int, id2 int, primary key(id1,id2))
type j2 (line 3582) | create table j2 (id1 int, id2 int, primary key(id1,id2))
type j1_id2_idx (line 3593) | create unique index j1_id2_idx on j1(id2) where id2 is not null
type j3 (line 3681) | create table j3 as select unique1, tenthous from onek
type j3 (line 3684) | create unique index on j3(unique1, tenthous)
FILE: sql/17.0/extra/limit.sql
type onek (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type int8_tbl (line 31) | CREATE FOREIGN TABLE int8_tbl(q1 int8 OPTIONS (key 'true')
type INT8_TMP (line 44) | CREATE FOREIGN TABLE INT8_TMP(
type tenk1 (line 54) | CREATE FOREIGN TABLE tenk1 (
type parent_table (line 74) | CREATE TABLE parent_table (
type limit_thousand_v_1 (line 416) | CREATE VIEW limit_thousand_v_1 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_2 (line 421) | CREATE VIEW limit_thousand_v_2 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 426) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_3 (line 429) | CREATE VIEW limit_thousand_v_3 AS SELECT thousand FROM onek WHERE thousa...
type limit_thousand_v_4 (line 434) | CREATE VIEW limit_thousand_v_4 AS SELECT thousand FROM onek WHERE thousa...
FILE: sql/17.0/extra/prepare.sql
type tenk1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type road (line 31) | CREATE FOREIGN TABLE road (
type road_tmp (line 37) | create foreign table road_tmp (a int, b int, id int options (key 'true')
FILE: sql/17.0/extra/select.sql
type onek (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type onek2 (line 31) | CREATE FOREIGN TABLE onek2 (
type INT8_TBL (line 51) | CREATE FOREIGN TABLE INT8_TBL(
type person (line 68) | CREATE FOREIGN TABLE person (
function sillysrf (line 364) | create function sillysrf(int) returns setof int as
type list_parted_tbl (line 385) | create table list_parted_tbl (a int,b int) partition by list (a)
type list_parted_tbl1 (line 387) | create table list_parted_tbl1 partition of list_parted_tbl
FILE: sql/17.0/extra/select_having.sql
type test_having (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
FILE: sql/17.0/extra/sqlite_fdw_post.sql
type ft1 (line 75) | CREATE FOREIGN TABLE ft1 (
type ft2 (line 90) | CREATE FOREIGN TABLE ft2 (
type ft5 (line 105) | CREATE FOREIGN TABLE ft4 (
type ft2 (line 119) | CREATE FOREIGN TABLE ft6 (
function sqlite_fdw_abs (line 346) | CREATE FUNCTION sqlite_fdw_abs(int) RETURNS int AS $$
type v4 (line 861) | CREATE VIEW v4 AS SELECT * FROM ft4
type v5 (line 863) | CREATE VIEW v5 AS SELECT * FROM ft5
function least_accum (line 1126) | create function least_accum(anyelement, variadic anyarray)
function f_test (line 1557) | CREATE OR REPLACE FUNCTION f_test(p_c1 int) RETURNS int AS $$
type reind_fdw_parent (line 1577) | CREATE FOREIGN TABLE reindex_foreign (c1 int, c2 int)
type ft3 (line 1668) | create foreign table ft3 (f1 text collate "C", f2 text, f3 varchar(10))
function "S 1" (line 2011) | CREATE OR REPLACE FUNCTION "S 1".F_BRTRIG() RETURNS trigger AS $$
type ft1_constraint (line 2037) | CREATE FOREIGN TABLE ft1_constraint (
function row_before_insupd_trigfunc (line 2238) | CREATE FUNCTION row_before_insupd_trigfunc() RETURNS trigger AS $$BEGIN ...
type foreign_tbl (line 2241) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type rw_view (line 2246) | CREATE VIEW rw_view AS SELECT * FROM foreign_tbl
type foreign_tbl (line 2296) | CREATE FOREIGN TABLE foreign_tbl (a int OPTIONS (key 'true')
type parent_tbl (line 2302) | CREATE TABLE parent_tbl (a int, b int) PARTITION BY RANGE(a)
type rw_view (line 2312) | CREATE VIEW rw_view AS SELECT * FROM parent_tbl
type loc1 (line 2392) | create foreign table loc1 (f1 serial, f2 text, id integer options (key '...
type grem1 (line 2416) | create foreign table grem1 (
function trigger_func (line 2483) | CREATE FUNCTION trigger_func() RETURNS trigger LANGUAGE plpgsql AS $$
function trigger_data (line 2498) | CREATE OR REPLACE FUNCTION trigger_data() RETURNS trigger
function trig_null (line 2736) | CREATE FUNCTION trig_null() RETURNS TRIGGER AS $$
type a (line 2925) | CREATE TABLE a (aa TEXT)
type foo (line 2999) | create table foo (f1 int, f2 int)
type bar (line 3001) | create foreign table foo2 (f3 int OPTIONS (key 'true')) inherits (foo)
type bar (line 3006) | create foreign table bar2 (f3 int OPTIONS (key 'true')) inherits (bar)
type foo2child (line 3050) | create foreign table foo2child (f3 int)
type i_foo_f1 (line 3119) | create index i_foo_f1 on foo(f1)
type parent (line 3193) | create table parent (a int, b text)
type "S 1" (line 3707) | CREATE FOREIGN TABLE tru_pk_ftable (id int)
type table30 (line 4371) | CREATE FOREIGN TABLE table30 ( x int )
type batch_size (line 4397) | CREATE FOREIGN TABLE ftable ( x int OPTIONS (key 'true') ) SERVER sqlite...
type batch_size (line 4417) | CREATE FOREIGN TABLE ftable ( x int ) SERVER sqlite_svr OPTIONS ( table ...
type inv_bsz (line 4964) | CREATE FOREIGN TABLE inv_bsz (c1 int )
FILE: sql/17.0/extra/update.sql
type update_test (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type upsert_test (line 19) | CREATE FOREIGN TABLE upsert_test (
FILE: sql/17.0/selectfunc.sql
type s3 (line 13) | CREATE FOREIGN TABLE s3(id text OPTIONS (key 'true')
FILE: sql/17.0/sqlite_fdw.sql
type department (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type employee (line 11) | CREATE FOREIGN TABLE employee(emp_id int OPTIONS (key 'true')
type empdata (line 13) | CREATE FOREIGN TABLE empdata(emp_id int OPTIONS (key 'true')
type numbers (line 15) | CREATE FOREIGN TABLE numbers(a int OPTIONS (key 'true')
type multiprimary (line 17) | CREATE FOREIGN TABLE multiprimary(a int, b int OPTIONS (key 'true')
type noprimary (line 19) | CREATE FOREIGN TABLE noprimary(a int, b text)
type RO_RW_test (line 21) | CREATE FOREIGN TABLE RO_RW_test(i int OPTIONS (key 'true')
function test_param_WHERE (line 128) | create or replace function test_param_WHERE() returns void as $$
type columntest (line 509) | CREATE FOREIGN TABLE columntest(a int OPTIONS(column_name 'a a', key 'tr...
type fts_table (line 537) | CREATE FOREIGN TABLE fts_table (name text, description text)
type grem1_2 (line 583) | CREATE FOREIGN TABLE grem1_2 (
type case_exp (line 596) | CREATE FOREIGN TABLE case_exp(c1 int OPTIONS (key 'true')
FILE: sql/17.0/types/bitstring.sql
type "type_BIT" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_VARBIT" (line 45) | CREATE FOREIGN TABLE "type_VARBIT"( "i" int OPTIONS (key 'true'), "b" va...
FILE: sql/17.0/types/bool.sql
type "type_BOOLEAN" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_BOOLEANpk" (line 93) | CREATE FOREIGN TABLE "type_BOOLEANpk" (col bool OPTIONS (key 'true')
FILE: sql/17.0/types/float4.sql
type FLOAT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT4_TMP (line 12) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type NON_ERROR_THROWING_API_FLOAT4 (line 72) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_FLOAT4(f1 text, id serial OP...
function xfloat4in (line 445) | create function xfloat4in(cstring) returns xfloat4 immutable strict
function xfloat4out (line 448) | create function xfloat4out(xfloat4) returns cstring immutable strict
type testdata (line 468) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/17.0/types/float8.sql
type FLOAT8_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type FLOAT8_TMP (line 12) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type NON_ERROR_THROWING_API_FLOAT8 (line 60) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_FLOAT8(f1 text, id serial OP...
function xfloat8in (line 904) | create function xfloat8in(cstring) returns xfloat8 immutable strict
function xfloat8out (line 907) | create function xfloat8out(xfloat8) returns cstring immutable strict
type testdata (line 927) | create foreign table testdata(bits text, id int OPTIONS (key 'true')
FILE: sql/17.0/types/int4.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 12) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type NON_ERROR_THROWING_API_INT4 (line 55) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_INT4(f1 text, id serial OPTI...
type FLOAT8_TMP (line 282) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 300) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
type special_case_int4 (line 374) | CREATE FOREIGN TABLE special_case_int4 (f1 text, id int OPTIONS (key 'tr...
FILE: sql/17.0/types/int8.sql
type INT8_TBL (line 8) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT8_TMP (line 16) | CREATE FOREIGN TABLE INT8_TMP(
type NON_ERROR_THROWING_API_INT8 (line 57) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_INT8(f1 text, id serial OPTI...
type FLOAT8_TMP (line 549) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, id int OPTIONS (key 'true')
type NUMERIC_TMP (line 567) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, id int OPTIONS (key 'true')
type special_case_int8 (line 642) | CREATE FOREIGN TABLE special_case_int8 (f1 text, id int OPTIONS (key 'tr...
FILE: sql/17.0/types/json.sql
type "type_JSON" (line 6) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type "type_JSONB" (line 21) | CREATE FOREIGN TABLE "type_JSONB" (
type "type_JSONB+" (line 32) | CREATE FOREIGN TABLE "type_JSONB+" (
type json_osm_test (line 804) | CREATE FOREIGN TABLE json_osm_test (
FILE: sql/17.0/types/numeric.sql
type num_data (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type num_exp_add (line 13) | CREATE FOREIGN TABLE num_exp_add (id1 int4 OPTIONS (key 'true')
type num_exp_sub (line 15) | CREATE FOREIGN TABLE num_exp_sub (id1 int4 OPTIONS (key 'true')
type num_exp_div (line 17) | CREATE FOREIGN TABLE num_exp_div (id1 int4 OPTIONS (key 'true')
type num_exp_mul (line 19) | CREATE FOREIGN TABLE num_exp_mul (id1 int4 OPTIONS (key 'true')
type num_exp_sqrt (line 21) | CREATE FOREIGN TABLE num_exp_sqrt (id int4 OPTIONS (key 'true')
type num_exp_ln (line 23) | CREATE FOREIGN TABLE num_exp_ln (id int4 OPTIONS (key 'true')
type num_exp_log10 (line 25) | CREATE FOREIGN TABLE num_exp_log10 (id int4 OPTIONS (key 'true')
type num_exp_power_10_ln (line 27) | CREATE FOREIGN TABLE num_exp_power_10_ln (id int4 OPTIONS (key 'true')
type num_variance (line 30) | CREATE FOREIGN TABLE num_variance (a numeric)
type num_result (line 33) | CREATE FOREIGN TABLE num_result (id1 int4 OPTIONS (key 'true')
type v (line 1148) | CREATE FOREIGN TABLE v (id int4 OPTIONS (key 'true')
type fract_only (line 1549) | CREATE FOREIGN TABLE fract_only (id int, val numeric(4,4))
type num_tmp (line 1583) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
type FLOAT8_TMP (line 1676) | CREATE FOREIGN TABLE FLOAT8_TMP(f1 float8, f2 float8, id int OPTIONS (ke...
type NUMERIC_TMP (line 1699) | CREATE FOREIGN TABLE NUMERIC_TMP(f1 numeric, f2 numeric, id int OPTIONS ...
type FLOAT4_TMP (line 1722) | CREATE FOREIGN TABLE FLOAT4_TMP(f1 float4, id int OPTIONS (key 'true')
type ceil_floor_round (line 1837) | CREATE FOREIGN TABLE ceil_floor_round (a numeric OPTIONS (key 'true')
type INT4_TMP (line 1857) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type width_bucket_tbl (line 1902) | CREATE FOREIGN TABLE width_bucket_tbl (
type width_bucket_test (line 1982) | CREATE FOREIGN TABLE width_bucket_test (
type ceil_round_float8 (line 2239) | CREATE FOREIGN TABLE ceil_round_float8(a float8)
type to_number_tbl (line 2268) | create foreign table to_number_tbl (a text, id int options (key 'true')
type num_input_test (line 2432) | CREATE FOREIGN TABLE num_input_test (n1 numeric)
type NON_ERROR_THROWING_API_INT4_NUMERIC (line 2515) | CREATE FOREIGN TABLE NON_ERROR_THROWING_API_INT4_NUMERIC(f1 text, id ser...
type num_typemod_test (line 2533) | CREATE FOREIGN TABLE num_typemod_test (
type num_tmp (line 2584) | CREATE FOREIGN TABLE num_tmp (n1 numeric, n2 numeric, id int options (ke...
FILE: sql/17.0/types/out_of_range.sql
type INT4_TBL (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type INT4_TMP (line 13) | CREATE FOREIGN TABLE INT4_TMP(f1 int4, f2 int4, id int OPTIONS (key 'true')
type INT2_TBL (line 42) | CREATE FOREIGN TABLE INT2_TBL(f1 int2 OPTIONS (key 'true')
type INT2_TMP (line 44) | CREATE FOREIGN TABLE INT2_TMP(f1 int2, f2 int2, id int OPTIONS (key 'true')
type INT8_TBL (line 73) | CREATE FOREIGN TABLE INT8_TBL(q1 int8 OPTIONS (key 'true')
FILE: sql/17.0/types/timestamp.sql
type dates1 (line 7) | CREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw
type dates2 (line 18) | CREATE FOREIGN TABLE dates2 (
type inf_timestamp (line 166) | CREATE FOREIGN TABLE inf_timestamp (
FILE: sql/17.0/types/uuid.sql
type "type_UUIDpk" (line 210) | CREATE FOREIGN TABLE "type_UUIDpk" (col uuid OPTIONS (key 'true')
FILE: sql/17.0/with_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/17.0/with_gis_support/postgis.sql
type "♂" (line 18) | CREATE TABLE "♂"."テスト" (
type "♁" (line 43) | CREATE TABLE "♁" (
type "types_PostGIS" (line 165) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 219) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 245) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/17.0/with_gis_support/type.sql
type "type_BOOLEAN" (line 144) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/17.0/without_gis_support/auto_import.sql
type ft (line 13) | CREATE VIEW ft AS (
type fc (line 23) | CREATE VIEW fc AS (
FILE: sql/17.0/without_gis_support/nogis.sql
type "types_PostGIS" (line 43) | CREATE FOREIGN TABLE "types_PostGIS"( "i" int OPTIONS (key 'true')
type "♂" (line 81) | CREATE FOREIGN TABLE "♂" (
type "♁ FDW" (line 107) | CREATE FOREIGN TABLE "♁ FDW"(
FILE: sql/17.0/without_gis_support/type.sql
type "type_BOOLEAN" (line 141) | CREATE FOREIGN TABLE "type_BOOLEAN" (i int, b boolean OPTIONS (key 'true')
FILE: sql/init_data/init.sql
type department (line 11) | CREATE TABLE department(department_id int primary key, department_name t...
type employee (line 12) | CREATE TABLE employee(emp_id int primary key, emp_name text, emp_dept_id...
type empdata (line 13) | CREATE TABLE empdata(emp_id int primary key, emp_dat bytea)
type numbers (line 14) | CREATE TABLE numbers(a int primary key, b varchar(255) unique)
type t (line 15) | CREATE TABLE t(a integer primary key, b integer)
type multiprimary (line 16) | CREATE TABLE multiprimary(a integer, b integer, c integer, primary key(b...
type columntest (line 17) | CREATE TABLE columntest("a a" integer, "b b" integer,"c c" integer, prim...
type noprimary (line 18) | CREATE TABLE noprimary(a integer, b text)
type limittest (line 19) | CREATE TABLE limittest(id int primary key, x integer, y text)
type grem1_1 (line 20) | create table grem1_1 (a int primary key, b int generated always as (a * ...
type grem1_2 (line 21) | create table grem1_2 (a int primary key, b int generated always as (a * ...
type case_exp (line 22) | CREATE TABLE case_exp(c1 int primary key, c3 text, c6 varchar(10))
type "type_STRING" (line 24) | CREATE TABLE "type_STRING" (col text primary key)
type "type_BOOLEANpk" (line 25) | CREATE TABLE "type_BOOLEANpk" (col boolean primary key)
type "type_BOOLEAN" (line 26) | CREATE TABLE "type_BOOLEAN" (i int primary key, b boolean)
type "type_BOOLEAN+" (line 27) | CREATE VIEW "type_BOOLEAN+" AS SELECT *, typeof("b") t, length("b") l F...
type "type_BYTE" (line 28) | CREATE TABLE "type_BYTE" (col char(1) primary key)
type "type_SINT" (line 29) | CREATE TABLE "type_SINT" (col smallint primary key)
type "type_BINT" (line 30) | CREATE TABLE "type_BINT" (col bigint primary key)
type "type_INTEGER" (line 31) | CREATE TABLE "type_INTEGER" (col integer primary key)
type "type_FLOAT" (line 32) | CREATE TABLE "type_FLOAT" (col float primary key)
type "type_DOUBLE" (line 33) | CREATE TABLE "type_DOUBLE" (col double primary key)
type "type_TIMESTAMP" (line 34) | CREATE TABLE "type_TIMESTAMP" (col timestamp primary key, b timestamp)
type "type_BLOB" (line 35) | CREATE TABLE "type_BLOB" (col blob primary key)
type "type_DATE" (line 36) | CREATE TABLE "type_DATE" (col date primary key)
type "type_TIME" (line 37) | CREATE TABLE "type_TIME" (col time primary key)
type "type_BIT" (line 38) | CREATE TABLE "type_BIT" (i int, b bit)
type "type_BIT+" (line 39) | CREATE VIEW "type_BIT+" AS SELECT *, typeof(b) t, length(b) l FROM "typ...
type "type_VARBIT" (line 40) | CREATE TABLE "type_VARBIT" (i int, b bit)
type "type_VARBIT+" (line 41) | CREATE VIEW "type_VARBIT+" AS SELECT *, typeof(b) t, length(b) l FROM "...
type "type_UUIDpk" (line 42) | CREATE TABLE "type_UUIDpk" (col uuid primary key)
type "type_UUID" (line 43) | CREATE TABLE "type_UUID" (i int, u uuid)
type "type_UUID+" (line 44) | CREATE VIEW "type_UUID+" AS SELECT
type "type_MACADDRpk" (line 51) | CREATE TABLE "type_MACADDRpk" (col macaddr primary key)
type "type_MACADDR" (line 52) | CREATE TABLE "type_MACADDR" (i int, m macaddr)
type "type_MACADDR+" (line 53) | CREATE VIEW "type_MACADDR+" AS SELECT *, typeof("m") t, length("m") l, ...
type "type_MACADDR8pk" (line 54) | CREATE TABLE "type_MACADDR8pk" (col macaddr8 primary key)
type "type_MACADDR8" (line 55) | CREATE TABLE "type_MACADDR8" (i int, m macaddr8)
type "type_MACADDR8+" (line 56) | CREATE VIEW "type_MACADDR8+" AS SELECT *, typeof("m") t, length("m") l,...
type "types_PostGIS" (line 57) | CREATE TABLE "types_PostGIS" (i int, gm geometry, gg geography, r raster...
type "type_JSON" (line 58) | CREATE TABLE "type_JSON" (i int, j json, ot varchar(8), oi int, q text[]...
type "type_JSONB" (line 59) | CREATE TABLE "type_JSONB" (i int, j jsonb, ot varchar(8), oi int, q text...
type "type_JSONB+" (line 60) | CREATE VIEW "type_JSONB+" AS SELECT
type BitT (line 66) | CREATE TABLE BitT (p integer primary key, a BIT(3), b BIT VARYING(5))
type notype (line 67) | CREATE TABLE notype (a)
type typetest (line 68) | CREATE TABLE typetest (i integer, v varchar(10) , c char(10), t text, d ...
type type_TEXT (line 69) | CREATE TABLE type_TEXT (col text primary key)
type alltypetest (line 70) | CREATE TABLE alltypetest (
type json_osm_test (line 97) | CREATE TABLE json_osm_test (
type shorty (line 106) | CREATE TABLE shorty (
type "A a" (line 111) | CREATE TABLE "A a" (col int primary key)
type fts_table (line 114) | CREATE VIRTUAL TABLE fts_table USING fts5(name, description, tokenize = ...
type RO_RW_test (line 117) | CREATE TABLE RO_RW_test (
type "Unicode data" (line 127) | CREATE TABLE "Unicode data" (i text primary key, t text)
type "type_BOOLEAN_oper" (line 151) | CREATE TABLE "type_BOOLEAN_oper" AS
type "♁" (line 163) | CREATE TABLE "♁" (
type "♂" (line 175) | CREATE TABLE "♂" (
FILE: sql/init_data/init_core.sql
type FLOAT4_TBL (line 24) | CREATE TABLE FLOAT4_TBL (f1 REAL)
type FLOAT4_TMP (line 25) | CREATE TABLE FLOAT4_TMP (f1 REAL, id integer primary key autoincrement)
type FLOAT8_TBL (line 26) | CREATE TABLE FLOAT8_TBL(f1 DOUBLE PRECISION)
type FLOAT8_TMP (line 27) | CREATE TABLE FLOAT8_TMP (f1 DOUBLE PRECISION, f2 DOUBLE PRECISION, id in...
type INT2_TBL (line 28) | CREATE TABLE INT2_TBL(f1 int2)
type INT2_TMP (line 29) | CREATE TABLE INT2_TMP (f1 int2, f2 smallint, id integer primary key auto...
type INT4_TBL (line 30) | CREATE TABLE INT4_TBL(f1 int4)
type INT4_TMP (line 31) | CREATE TABLE INT4_TMP (f1 int4, f2 int, id integer primary key autoincre...
type INT8_TBL (line 32) | CREATE TABLE INT8_TBL(
type INT8_TMP (line 37) | CREATE TABLE INT8_TMP(
type test_having (line 58) | CREATE TABLE test_having (a int, b int, c char(8), d char)
type onek (line 59) | CREATE TABLE onek (
type onek2 (line 78) | CREATE TABLE onek2 (
type tenk1 (line 97) | CREATE TABLE tenk1 (
type tenk2 (line 116) | CREATE TABLE tenk2 (
type aggtest (line 135) | CREATE TABLE aggtest (
type student (line 140) | CREATE TABLE student (
type person (line 147) | CREATE TABLE person (
type road (line 155) | CREATE TABLE road (
type road_tmp (line 160) | create table road_tmp (a int, b int, id integer primary key autoincrement)
type dates (line 162) | CREATE TABLE dates (
type btg (line 168) | CREATE TABLE btg(id int primary key, p int, v text, c float, d float, e ...
type btg_groupby (line 169) | CREATE TABLE btg_groupby(x int, y int, z text, w int)
type group_agg_pk (line 170) | CREATE TABLE group_agg_pk (x int, y int, z int, w int, f int)
type bitwise_test (line 185) | CREATE TABLE bitwise_test(
type bool_test (line 193) | CREATE TABLE bool_test(
type bool_test_tmp (line 199) | CREATE TABLE bool_test_tmp(
type minmaxtest (line 205) | create table minmaxtest(f1 int)
type agg_tb (line 206) | create table agg_tb(v int, id integer primary key autoincrement)
type agg_tb2 (line 207) | create table agg_tb2(v text)
type agg_t1 (line 208) | create table agg_t1 (a int, b int, c int, d int, primary key (a, b))
type agg_t2 (line 209) | create table agg_t2 (x int, y int, z int, primary key (x, y))
type agg_t3 (line 210) | create table agg_t3 (a float8, b float8, id integer primary key autoincr...
type agg_t4 (line 211) | create table agg_t4 (a float4, b float4, id integer primary key autoincr...
type agg_t5 (line 212) | create table agg_t5 (a numeric, b numeric, id integer primary key autoin...
type agg_t6 (line 213) | create table agg_t6 (a float8, id integer primary key autoincrement)
type agg_t7 (line 214) | create table agg_t7 (a float8, b float8, c float8, d float8, id integer ...
type agg_t8 (line 215) | create table agg_t8 (a text, b text, primary key (a))
type regr_test (line 216) | CREATE TABLE regr_test (x float8, y float8, id integer primary key autoi...
type agg_t9 (line 217) | create table agg_t9 (a int, b int, c int, primary key (a, b))
type agg_t10 (line 218) | create table agg_t10(one int, id integer primary key autoincrement)
type agg_t11 (line 219) | create table agg_t11(one int, two int, id integer primary key autoincrem...
type agg_t12 (line 220) | create table agg_t12(a int, id integer primary key autoincrement)
type agg_t13 (line 221) | create table agg_t13(x int, id integer primary key autoincrement)
type agg_t14 (line 222) | create table agg_t14(x int, y int, id integer primary key autoincrement)
type agg_data_2k (line 223) | create table agg_data_2k(g int , id integer primary key autoincrement)
type agg_data_20k (line 224) | create table agg_data_20k(g int , id integer primary key autoincrement)
type t1 (line 225) | create table t1(f1 int4, f2 int8)
type t2 (line 226) | create table t2(f1 int8, f2 int8)
type agg_t15 (line 227) | create table agg_t15(a text, b int, c int, id integer primary key autoin...
type agg_t16 (line 228) | create table agg_t16(a text, b text, id integer primary key autoincrement)
type agg_t17 (line 229) | create table agg_t17(foo text, bar text)
type agg_t170 (line 230) | create table agg_t170(v int)
type agg_t18 (line 231) | create table agg_t18 (inner_c int)
type agg_t19 (line 232) | create table agg_t19 (outer_c int)
type agg_t20 (line 233) | create table agg_t20 (x text)
type agg_t21 (line 234) | create table agg_t21 (x int)
type agg_t22 (line 235) | create table agg_t22 (c1 text, id int)
type agg_t23 (line 236) | create table agg_t23 (id int)
type float_tb (line 237) | CREATE TABLE float_tb(f real)
type multi_arg_agg (line 240) | create table multi_arg_agg (a int, b int, c text)
type agg_group_1 (line 242) | create table agg_group_1 (c1 int, c2 numeric, c3 int)
type agg_group_2 (line 243) | create table agg_group_2 (a int , c1 numeric, c2 text, c3 int)
type agg_group_3 (line 244) | create table agg_group_3 (c1 numeric, c2 int, c3 int)
type agg_group_4 (line 245) | create table agg_group_4 (c1 numeric, c2 text, c3 int)
type agg_hash_1 (line 247) | create table agg_hash_1 (c1 int, c2 numeric, c3 int)
type agg_hash_2 (line 248) | create table agg_hash_2 (a int , c1 numeric, c2 text, c3 int)
type agg_hash_3 (line 249) | create table agg_hash_3 (c1 numeric, c2 int, c3 int)
type agg_hash_4 (line 250) | create table agg_hash_4 (c1 numeric, c2 text, c3 int)
type testdata (line 253) | create table testdata(bits text, id integer primary key autoincrement)
type NON_ERROR_THROWING_API_FLOAT4 (line 254) | CREATE TABLE NON_ERROR_THROWING_API_FLOAT4(f1 text, id serial)
type NON_ERROR_THROWING_API_FLOAT8 (line 257) | CREATE TABLE NON_ERROR_THROWING_API_FLOAT8(f1 text, id serial)
type numeric_tmp (line 260) | create table numeric_tmp(f1 numeric, f2 numeric , id integer primary key...
type NON_ERROR_THROWING_API_INT4 (line 261) | CREATE TABLE NON_ERROR_THROWING_API_INT4(f1 text, id serial)
type special_case_int4 (line 262) | CREATE TABLE special_case_int4 (f1 text, id integer primary key autoincr...
type VARCHAR_TBL (line 264) | CREATE TABLE VARCHAR_TBL(f1 varchar(4))
type NON_ERROR_THROWING_API_INT8 (line 267) | CREATE TABLE NON_ERROR_THROWING_API_INT8(f1 text, id serial)
type special_case_int8 (line 268) | CREATE TABLE special_case_int8 (f1 text, id integer primary key autoincr...
type bytea_test_table (line 277) | create table bytea_test_table(v bytea)
type pagg_test (line 278) | create table pagg_test (x int, y int)
type num_data (line 282) | CREATE TABLE num_data (id int4, val numeric, primary key (id))
type num_exp_add (line 283) | CREATE TABLE num_exp_add (id1 int4, id2 int4, expected numeric, primary ...
type num_exp_sub (line 284) | CREATE TABLE num_exp_sub (id1 int4, id2 int4, expected numeric, primary ...
type num_exp_div (line 285) | CREATE TABLE num_exp_div (id1 int4, id2 int4, expected numeric, primary ...
type num_exp_mul (line 286) | CREATE TABLE num_exp_mul (id1 int4, id2 int4, expected numeric, primary ...
type num_exp_sqrt (line 287) | CREATE TABLE num_exp_sqrt (id int4, expected numeric, primary key (id))
type num_exp_ln (line 288) | CREATE TABLE num_exp_ln (id int4, expected numeric, primary key (id))
type num_exp_log10 (line 289) | CREATE TABLE num_exp_log10 (id int4, expected numeric, primary key (id))
type num_exp_power_10_ln (line 290) | CREATE TABLE num_exp_power_10_ln (id int4, expected numeric, primary key...
type num_variance (line 291) | CREATE TABLE num_variance (a numeric)
type num_result (line 293) | CREATE TABLE num_result (id1 int4, id2 int4, result numeric, primary key...
type v (line 294) | CREATE TABLE v (id int4, x numeric, val float8, primary key (id))
type fract_only (line 296) | CREATE TABLE fract_only (id int, val numeric(4,4))
type ceil_floor_round (line 297) | CREATE TABLE ceil_floor_round (a numeric primary key)
type ceil_round_float8 (line 298) | CREATE TABLE ceil_round_float8(a float8)
type width_bucket_tbl (line 299) | CREATE TABLE width_bucket_tbl (id1 numeric, id2 numeric, id3 numeric, id...
type width_bucket_test (line 300) | CREATE TABLE width_bucket_test (operand_num numeric, operand_f8 float8)
type num_input_test (line 301) | CREATE TABLE num_input_test (n1 numeric)
type num_trigger_test (line 302) | CREATE TABLE num_trigger_test(n1 float8)
type num_tmp (line 304) | CREATE TABLE num_tmp (n1 numeric, n2 numeric, id integer primary key aut...
type to_number_tbl (line 306) | CREATE TABLE to_number_tbl(a text, id integer primary key autoincrement)
type num_typemod_test (line 307) | CREATE TABLE num_typemod_test (
type NON_ERROR_THROWING_API_INT4_NUMERIC (line 315) | CREATE TABLE NON_ERROR_THROWING_API_INT4_NUMERIC(f1 text, id serial)
type q1 (line 319) | create table q1 (i int)
type q2 (line 320) | create table q2 (i int)
type foo (line 321) | CREATE TABLE foo (f1 int)
type J1_TBL (line 323) | CREATE TABLE J1_TBL (
type J2_TBL (line 329) | CREATE TABLE J2_TBL (
type sub_tbl (line 334) | create table sub_tbl (key1 int, key3 int, key5 int, key6 int, value1 int...
type t11 (line 336) | CREATE TABLE t11 (name TEXT, n INTEGER)
type t21 (line 337) | CREATE TABLE t21 (name TEXT, n INTEGER)
type t31 (line 338) | CREATE TABLE t31 (name TEXT, n INTEGER)
type x (line 339) | create table x (x1 int, x2 int)
type y (line 340) | create table y (y1 int, y2 int)
type t12 (line 342) | CREATE TABLE t12 (a int, b int)
type t22 (line 343) | CREATE TABLE t22 (a int, b int)
type t32 (line 344) | CREATE TABLE t32 (x int, y int)
type tt1 (line 346) | CREATE TABLE tt1 ( tt1_id int4, joincol int4 )
type tt2 (line 347) | CREATE TABLE tt2 ( tt2_id int4, joincol int4 )
type tt3 (line 348) | create table tt3(f1 int, f2 text)
type tt4 (line 349) | create table tt4(f1 int)
type tt4x (line 350) | create table tt4x(c1 int, c2 int, c3 int)
type tt5 (line 351) | create table tt5(f1 int, f2 int)
type tt6 (line 352) | create table tt6(f1 int, f2 int)
type xx (line 353) | create table xx (pkxx int)
type yy (line 354) | create table yy (pkyy int, pkxx int)
type zt1 (line 355) | create table zt1 (f1 int primary key)
type zt2 (line 356) | create table zt2 (f2 int primary key)
type zt3 (line 357) | create table zt3 (f3 int primary key)
type a1 (line 359) | create table a1 (i integer)
type b1 (line 360) | create table b1 (x integer, y integer)
type a2 (line 362) | create table a2 (
type b2 (line 366) | create table b2 (
type c2 (line 371) | create table c2 (
type nt1 (line 377) | create table nt1 (
type nt2 (line 382) | create table nt2 (
type nt3 (line 389) | create table nt3 (
type TEXT_TBL (line 396) | CREATE TABLE TEXT_TBL (f1 text)
type a3 (line 403) | CREATE TABLE a3 (id int PRIMARY KEY, b_id int)
type b3 (line 404) | CREATE TABLE b3 (id int PRIMARY KEY, c_id int)
type c3 (line 405) | CREATE TABLE c3 (id int PRIMARY KEY)
type d3 (line 406) | CREATE TABLE d3 (a int, b int)
type parent (line 408) | create table parent (k int primary key, pd int)
type child (line 409) | create table child (k int unique, cd int)
type a4 (line 411) | CREATE TABLE a4 (id int PRIMARY KEY)
type b4 (line 412) | CREATE TABLE b4 (id int PRIMARY KEY, a_id int)
type innertab (line 414) | create table innertab (id int8 primary key, dat1 int8)
type uniquetbl (line 415) | create table uniquetbl (f1 text unique)
type join_pt1 (line 417) | create table join_pt1 (a int, b int, c varchar)
type fkest (line 419) | create table fkest (a int, b int, c int unique, primary key(a,b))
type fkest1 (line 420) | create table fkest1 (a int, b int, primary key(a,b) foreign key (a,b) re...
type j11 (line 422) | create table j11 (id int primary key)
type j21 (line 423) | create table j21 (id int primary key)
type j31 (line 424) | create table j31 (id int)
type j12 (line 426) | create table j12 (id1 int, id2 int, primary key(id1,id2))
type j22 (line 427) | create table j22 (id1 int, id2 int, primary key(id1,id2))
type j32 (line 428) | create table j32 (id1 int, id2 int, primary key(id1,id2))
type inserttest01 (line 430) | create table inserttest01 (col1 int4, col2 int4 NOT NULL, col3 text defa...
type update_test (line 432) | CREATE TABLE update_test (
type upsert_test (line 439) | create table upsert_test (a int primary key, b text)
type t (line 441) | create table t (a int unique)
type tbl_ra (line 442) | create table tbl_ra(a int unique, b int)
type "type_FLOAT_INF" (line 444) | CREATE TABLE "type_FLOAT_INF" (i int primary key, f float)
type "type_FLOAT_INF+" (line 445) | CREATE VIEW "type_FLOAT_INF+" AS SELECT *, typeof("f") t, length("f") l...
type infinite_timestamp (line 450) | CREATE TABLE infinite_timestamp (
FILE: sql/init_data/init_post.sql
type "T 0" (line 33) | CREATE TABLE "T 0" (
type "T 1" (line 44) | CREATE TABLE "T 1" (
type "T 2" (line 55) | CREATE TABLE "T 2" (
type "T 3" (line 60) | CREATE TABLE "T 3" (
type "T 4" (line 66) | CREATE TABLE "T 4" (
type base_tbl (line 72) | CREATE TABLE base_tbl (a int, b int)
type loc1 (line 73) | CREATE TABLE loc1 (f1 INTEGER, f2 text, id integer primary key autoincre...
type loct (line 74) | CREATE TABLE loct (aa TEXT, bb TEXT)
type loct1 (line 75) | CREATE TABLE loct1 (f1 int, f2 int, f3 int)
type loct2 (line 76) | CREATE TABLE loct2 (f1 int, f2 int, f3 int)
type loct3 (line 77) | create table loct3 (a int, b text)
type loct4 (line 78) | create table loct4 (a int, b text)
type loct4_2 (line 79) | create table loct4_2 (f1 int, f2 int, f3 int)
type loct5 (line 80) | create table loct5 (a int check (a in (1)), b text)
type loct6 (line 81) | create table loct6 (a int check (a in (2)), b text)
type loct7 (line 82) | create table loct7 (a int check (a in (1)), b text)
type local_tbl (line 84) | create table local_tbl (c1 int primary key, c2 int, c3 text)
type ft3 (line 85) | create table ft3 (f1 text, f2 text, f3 text, primary key (f1, f2, f3))
type foreign_tbl (line 87) | create table foreign_tbl (a int primary key, b int)
type grem1 (line 88) | create table grem1 (a int primary key, b int)
type grem1_post14 (line 89) | create table grem1_post14 (a int primary key, b int generated always as ...
type loct1_rescan (line 91) | create table loct1_rescan (c1 int)
type loct2_rescan (line 92) | create table loct2_rescan (c1 int, c2 text)
type t1_constraint (line 94) | CREATE TABLE t1_constraint (
type tru_rtable0 (line 104) | CREATE TABLE tru_rtable0 (id int primary key)
type tru_pk_table (line 105) | CREATE TABLE tru_pk_table(id int primary key)
type tru_fk_table (line 106) | CREATE TABLE tru_fk_table(fkey int, CONSTRAINT tfk_pkey FOREIGN KEY (fke...
type tru_rtable_parent (line 107) | CREATE TABLE tru_rtable_parent (id int)
type tru_rtable_child (line 108) | CREATE TABLE tru_rtable_child (id int)
type loct_empty (line 109) | CREATE TABLE loct_empty (c1 int NOT NULL, c2 text, CONSTRAINT tloct_pkey...
type batch_table (line 110) | CREATE TABLE batch_table ( x int )
FILE: sql/init_data/init_selectfunc.sql
type s3 (line 3) | CREATE TABLE s3(id text primary key, time timestamp, tag1 text, value1 f...
FILE: sqlite_data_norm.c
function sqlite_fdw_data_norm_UuidHexToInt (line 101) | static unsigned char
function sqlite_fdw_uuid_blob (line 119) | static int
function sqlite3UuidBlobToStr (line 164) | static void
function sqlite_fdw_uuid_str (line 188) | static void
function sqlite_fdw_data_norm_uuid (line 225) | static void
function sqlite_fdw_data_norm_bool (line 249) | static void
function infinity_processing (line 359) | static bool
function sqlite_fdw_data_norm_float (line 390) | static void
function sqlite_fdw_macaddr_str (line 430) | static void
function sqlite_fdw_macaddr6_int (line 490) | static int
function sqlite_fdw_macaddr8_int (line 536) | static int
function sqlite_fdw_data_norm_macaddr (line 586) | static void
function sqlite_fdw_macaddr_blob (line 666) | static void
function error_catcher (line 720) | static void
function sqlite_fdw_data_norm_functs_init (line 740) | void
FILE: sqlite_fdw--1.0--1.1.sql
function sqlite_fdw_get_connections (line 6) | CREATE FUNCTION sqlite_fdw_get_connections (OUT server_name text,
function sqlite_fdw_disconnect (line 12) | CREATE FUNCTION sqlite_fdw_disconnect (text)
function sqlite_fdw_disconnect_all (line 20) | CREATE FUNCTION sqlite_fdw_disconnect_all ()
function sqlite_fdw_sqlite_version (line 37) | CREATE OR REPLACE FUNCTION sqlite_fdw_sqlite_version()
function sqlite_fdw_sqlite_code_source (line 45) | CREATE OR REPLACE FUNCTION sqlite_fdw_sqlite_code_source()
FILE: sqlite_fdw--1.0.sql
function sqlite_fdw_handler (line 6) | CREATE FUNCTION sqlite_fdw_handler()
function sqlite_fdw_validator (line 11) | CREATE FUNCTION sqlite_fdw_validator(text[], oid)
function sqlite_fdw_version (line 20) | CREATE OR REPLACE FUNCTION sqlite_fdw_version()
FILE: sqlite_fdw.c
type FdwPathPrivateIndex (line 93) | enum FdwPathPrivateIndex
type FdwScanPrivateIndex (line 108) | enum FdwScanPrivateIndex
type FdwModifyPrivateIndex (line 138) | enum FdwModifyPrivateIndex
type FdwDirectModifyPrivateIndex (line 157) | enum FdwDirectModifyPrivateIndex
type ExplainState (line 258) | struct ExplainState
type ExplainState (line 265) | struct ExplainState
type ExplainState (line 274) | struct ExplainState
type ConversionLocation (line 405) | typedef struct ConversionLocation
function _PG_init (line 418) | void
function sqlite_fdw_exit (line 427) | static void
function Datum (line 434) | Datum
function Datum (line 496) | Datum
function Datum (line 502) | Datum
function Datum (line 508) | Datum
function sqlite_prepare_wrapper (line 515) | static void
function sqliteGetForeignRelSize (line 539) | static void
function List (line 670) | static List *
function sqlite_add_paths_with_pathkeys_for_rel (line 713) | static void
function sqlite_all_baserels_are_foreign (line 854) | static bool
function sqliteGetForeignPaths (line 893) | static void
function ForeignScan (line 952) | static ForeignScan *
function TupleDesc (line 1215) | static TupleDesc
function sqliteBeginForeignScan (line 1267) | static void
function make_tuple_from_result_row (line 1369) | static void
function TupleTableSlot (line 1442) | static TupleTableSlot *
function sqliteEndForeignScan (line 1562) | static void
function sqliteReScanForeignScan (line 1584) | static void
function sqliteBeginForeignModify (line 1819) | static void
function sqliteBeginForeignInsert (line 1930) | static void
function sqliteEndForeignInsert (line 1936) | static void
function TupleTableSlot (line 1947) | static TupleTableSlot *
function TupleTableSlot (line 1967) | static TupleTableSlot **
function sqliteGetForeignModifyBatchSize (line 1990) | static int
function ForeignScan (line 2080) | static ForeignScan *
function sqlitePlanDirectModify (line 2144) | static bool
function sqliteBeginDirectModify (line 2386) | static void
function TupleTableSlot (line 2497) | static TupleTableSlot *
function sqliteEndDirectModify (line 2530) | static void
function sqliteExplainDirectModify (line 2552) | static void
function sqliteExecForeignTruncate (line 2574) | static void
function bindJunkColumnValue (line 2668) | static void
function TupleTableSlot (line 2711) | static TupleTableSlot *
function TupleTableSlot (line 2766) | static TupleTableSlot *
function sqliteEndForeignModify (line 2792) | static void
function sqliteExplainForeignScan (line 2806) | static void
function sqliteExplainForeignModify (line 2822) | static void
function sqliteAnalyzeForeignTable (line 2844) | static bool
function List (line 2856) | static List *
function sqlite_semijoin_target_ok (line 3033) | static bool
function sqlite_foreign_join_ok (line 3073) | static bool
function sqlite_adjust_foreign_grouping_path_cost (line 3357) | static void
function sqlite_merge_fdw_options (line 3559) | static void
function sqlite_foreign_grouping_ok (line 3597) | static bool
function sqliteGetForeignUpperPaths (line 3846) | static void
function sqlite_add_foreign_grouping_paths (line 3907) | static void
function sqlite_add_foreign_ordered_paths (line 3998) | static void
function sqlite_add_foreign_final_paths (line 4166) | static void
function sqlite_to_pg_type (line 4831) | static void
function sqlite_set_transmission_modes (line 4948) | int
function sqlite_reset_transmission_modes (line 4985) | void
function TupleTableSlot (line 4995) | static TupleTableSlot **
function sqlite_prepare_query_params (line 5083) | static void
function sqlite_process_query_params (line 5134) | static void
function sqlite_create_cursor (line 5186) | static void
function sqlite_execute_dml_stmt (line 5224) | static void
function EquivalenceMember (line 5275) | EquivalenceMember *
function EquivalenceMember (line 5314) | EquivalenceMember *
function sqlite_get_batch_size_option (line 5380) | static int
function sqliteIsForeignRelUpdatable (line 5424) | static int
function int32 (line 5476) | static int32
function sqlite_affinity_code (line 5545) | const int
function conversion_error_callback (line 5569) | static void
FILE: sqlite_fdw.h
type NullableDatum (line 88) | typedef struct NullableDatum
type sqlite_opt (line 102) | typedef struct sqlite_opt
type SqliteFdwPathExtraData (line 116) | typedef struct SqliteFdwPathExtraData
type SqliteFdwExecState (line 131) | typedef struct SQLiteFdwExecState
type SqliteFdwRelationInfo (line 178) | typedef struct SqliteFdwRelationInfo
type SqliteFdwDirectModifyState (line 273) | typedef struct SqliteFdwDirectModifyState
type blobOutput (line 309) | typedef struct blobOutput
FILE: sqlite_gis.c
function hasSRID (line 144) | static inline bool hasSRID (char *hexEWKB)
function blobOutput (line 175) | static inline blobOutput
function blobOutput (line 227) | blobOutput
function common_EWKB_error (line 243) | static void
function sqlite_deparse_PostGIS_value (line 268) | void
FILE: sqlite_query.c
function sqlite_value_to_pg_error (line 49) | static void
function pg_column_void_text_error (line 60) | static void
function NullableDatum (line 71) | NullableDatum
function blobOutput (line 696) | blobOutput
function sqlite_bind_sql_var (line 746) | void
function sqlite3_int64 (line 1115) | sqlite3_int64
function listed_datatype (line 1146) | bool
function listed_datatype_oid (line 1173) | bool
function blobOutput (line 1183) | static inline blobOutput
Condensed preview — 208 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (8,860K chars).
[
{
"path": ".dockerignore",
"chars": 51,
"preview": "*.sh\nfdw_rpm_with_pgspider/\nfdw_rpm_with_postgres/\n"
},
{
"path": ".gitattributes",
"chars": 155,
"preview": "*.c linguist-detectable=true\n*.h linguist-detectable=true\nexpected/* linguist-detectable=false\nsql/* linguist-detectable"
},
{
"path": ".github/workflows/CI.yml",
"chars": 3245,
"preview": "name: SQLite FDW test\n\non:\n workflow_dispatch:\n pull_request: \n push:\n branches:\n - master\n - main\njobs"
},
{
"path": ".gitignore",
"chars": 499,
"preview": "# Prerequisites\n*.d\n\n# Object files\n*.o\n*.ko\n*.obj\n*.elf\n\n# Linker output\n*.ilk\n*.map\n*.exp\n\n# Precompiled Headers\n*.gch"
},
{
"path": "GIS.md",
"chars": 5071,
"preview": "GIS support in SQLite Foreign Data Wrapper for PostgreSQL\n=========================================================\n\n<im"
},
{
"path": "GitHubActions/README.md",
"chars": 663,
"preview": "# CI environment of sqlite_fdw.\n\nTests will be executed automatically when commited to main/master branch and when a pul"
},
{
"path": "GitHubActions/build_postgis.sh",
"chars": 1160,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script downloads "
},
{
"path": "GitHubActions/build_postgres.sh",
"chars": 1060,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script downloads "
},
{
"path": "GitHubActions/build_sqlite_fdw.sh",
"chars": 1152,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script builds sql"
},
{
"path": "GitHubActions/detect_targets.sh",
"chars": 773,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script detects ta"
},
{
"path": "GitHubActions/download_postgis.sh",
"chars": 830,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script downloads "
},
{
"path": "GitHubActions/env.sh",
"chars": 630,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script configures"
},
{
"path": "GitHubActions/execute_test.sh",
"chars": 2001,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script executes a"
},
{
"path": "GitHubActions/install_locales.sh",
"chars": 671,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This script installs s"
},
{
"path": "GitHubActions/install_sqlite.sh",
"chars": 1866,
"preview": "#!/bin/bash\n\n################################################################################\n#\n# This sript downloads S"
},
{
"path": "License",
"chars": 1059,
"preview": "SQLite Foreign Data Wrapper for PostgreSQL\n\nCopyright (c) 2018, TOSHIBA CORPORATION\nCopyright (c) 2011 - 2016, Enterpris"
},
{
"path": "META.json",
"chars": 1128,
"preview": "{\n \"name\": \"sqlite_fdw\",\n \"abstract\": \"Foreign Data Wrapper for SQLite databases\",\n \"description\": \"PostgreSQL ext"
},
{
"path": "Makefile",
"chars": 3267,
"preview": "######################################################################--------------------------------------------------"
},
{
"path": "README.md",
"chars": 40903,
"preview": "SQLite Foreign Data Wrapper for PostgreSQL\n==========================================\n\nThis is a foreign data wrapper (F"
},
{
"path": "connection.c",
"chars": 31200,
"preview": "/*-------------------------------------------------------------------------\n *\n * SQLite Foreign Data Wrapper for Postgr"
},
{
"path": "deparse.c",
"chars": 130080,
"preview": "/*-------------------------------------------------------------------------\n *\n * SQLite Foreign Data Wrapper for Postgr"
},
{
"path": "option.c",
"chars": 6387,
"preview": "/*-------------------------------------------------------------------------\n *\n * SQLite Foreign Data Wrapper for Postgr"
},
{
"path": "sql/13.15/aggregate.sql",
"chars": 2983,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/13.15/extra/aggregates.sql",
"chars": 68354,
"preview": "--\n-- AGGREGATES\n--\n--Testcase 266:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 267:\nCREATE SERVER sqlite_svr FOREIGN DATA W"
},
{
"path": "sql/13.15/extra/encodings.sql",
"chars": 227792,
"preview": "-- tests for PR #76 github\n-- see https://www.postgresql.org/docs/current/multibyte.html\n-- EUC_CN, not tested\n-- EUC_JP"
},
{
"path": "sql/13.15/extra/insert.sql",
"chars": 26642,
"preview": "--\n-- insert with DEFAULT in the target_list\n--\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 17:\nCREATE SERVER"
},
{
"path": "sql/13.15/extra/join.sql",
"chars": 77464,
"preview": "--\n-- JOIN\n-- Test JOIN clauses\n--\n--Testcase 360:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 361:\nCREATE SERVER sqlite_svr"
},
{
"path": "sql/13.15/extra/limit.sql",
"chars": 11252,
"preview": "--\n-- LIMIT\n-- Check the LIMIT/OFFSET feature of SELECT\n--\n--Testcase 27:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 28:\nCR"
},
{
"path": "sql/13.15/extra/prepare.sql",
"chars": 3616,
"preview": "-- Regression tests for prepareable statements. We query the content\n-- of the pg_prepared_statements view as prepared s"
},
{
"path": "sql/13.15/extra/select.sql",
"chars": 10891,
"preview": "--\n-- SELECT\n--\n--Testcase 43:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 44:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/13.15/extra/select_having.sql",
"chars": 2438,
"preview": "--\n-- SELECT_HAVING\n--\n\n--Testcase 22:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 23:\nCREATE SERVER sqlite_svr FOREIGN DATA"
},
{
"path": "sql/13.15/extra/sqlite_fdw_post.sql",
"chars": 121557,
"preview": "-- ===================================================================\n-- create FDW objects\n-- ========================"
},
{
"path": "sql/13.15/extra/update.sql",
"chars": 25778,
"preview": "--\n-- UPDATE syntax tests\n--\n--Testcase 32:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 33:\nCREATE SERVER sqlite_svr FOREIGN"
},
{
"path": "sql/13.15/libsqlite.sql",
"chars": 311,
"preview": "-- Test for SQLite library code source and defaults\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nSELECT sqli"
},
{
"path": "sql/13.15/selectfunc.sql",
"chars": 14850,
"preview": "SET datestyle=ISO;\nSET timezone='Japan';\n\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER server1"
},
{
"path": "sql/13.15/sqlite_fdw.sql",
"chars": 30874,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 129:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/types/bitstring.sql",
"chars": 9084,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/types/bool.sql",
"chars": 6324,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 000:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/types/float4.sql",
"chars": 24643,
"preview": "--\n-- FLOAT4\n--\n--Testcase 46:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 47:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/13.15/types/float8.sql",
"chars": 31358,
"preview": "--\n-- FLOAT8\n--\n--Testcase 113:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 114:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPP"
},
{
"path": "sql/13.15/types/int4.sql",
"chars": 9874,
"preview": "--\n-- INT4 Based on PostgreSQL tests, please don't add additional tests here, use other test files\n--\n--Testcase 61:\nCRE"
},
{
"path": "sql/13.15/types/int8.sql",
"chars": 18537,
"preview": "--\n-- INT8\n-- Test int8 64-bit integers.\n--\n--Testcase 140:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 141:\nCREATE SERVER s"
},
{
"path": "sql/13.15/types/json.sql",
"chars": 221595,
"preview": "-- SET log_min_messages TO DEBUG3;\n-- SET client_min_messages TO DEBUG3;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/types/macaddr.sql",
"chars": 14211,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/types/macaddr8.sql",
"chars": 14962,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/types/numeric.sql",
"chars": 79827,
"preview": "--\n-- NUMERIC\n--\n--Testcase 567:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 568:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAP"
},
{
"path": "sql/13.15/types/out_of_range.sql",
"chars": 3598,
"preview": "--\n-- INT4 + INT2\n--\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 002:\nCREATE SERVER sqlite_svr FOREIGN DATA "
},
{
"path": "sql/13.15/types/timestamp.sql",
"chars": 4868,
"preview": "--\n-- TIMESTAMP\n--\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPE"
},
{
"path": "sql/13.15/types/uuid.sql",
"chars": 10381,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/13.15/with_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/13.15/with_gis_support/postgis.sql",
"chars": 105511,
"preview": "--Testcase 2:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 3:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/13.15/with_gis_support/type.sql",
"chars": 8418,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/13.15/without_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/13.15/without_gis_support/nogis.sql",
"chars": 8433,
"preview": "--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/13.15/without_gis_support/type.sql",
"chars": 8376,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/14.12/aggregate.sql",
"chars": 2983,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/14.12/extra/aggregates.sql",
"chars": 68333,
"preview": "--\n-- AGGREGATES\n--\n--Testcase 266:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 267:\nCREATE SERVER sqlite_svr FOREIGN DATA W"
},
{
"path": "sql/14.12/extra/encodings.sql",
"chars": 227792,
"preview": "-- tests for PR #76 github\n-- see https://www.postgresql.org/docs/current/multibyte.html\n-- EUC_CN, not tested\n-- EUC_JP"
},
{
"path": "sql/14.12/extra/insert.sql",
"chars": 27382,
"preview": "--\n-- insert with DEFAULT in the target_list\n--\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 17:\nCREATE SERVER"
},
{
"path": "sql/14.12/extra/join.sql",
"chars": 81824,
"preview": "--\n-- JOIN\n-- Test JOIN clauses\n--\n--Testcase 360:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 361:\nCREATE SERVER sqlite_svr"
},
{
"path": "sql/14.12/extra/limit.sql",
"chars": 11252,
"preview": "--\n-- LIMIT\n-- Check the LIMIT/OFFSET feature of SELECT\n--\n--Testcase 27:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 28:\nCR"
},
{
"path": "sql/14.12/extra/prepare.sql",
"chars": 3616,
"preview": "-- Regression tests for prepareable statements. We query the content\n-- of the pg_prepared_statements view as prepared s"
},
{
"path": "sql/14.12/extra/select.sql",
"chars": 10892,
"preview": "--\n-- SELECT\n--\n--Testcase 43:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 44:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/14.12/extra/select_having.sql",
"chars": 2438,
"preview": "--\n-- SELECT_HAVING\n--\n\n--Testcase 22:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 23:\nCREATE SERVER sqlite_svr FOREIGN DATA"
},
{
"path": "sql/14.12/extra/sqlite_fdw_post.sql",
"chars": 155515,
"preview": "-- ===================================================================\n-- create FDW objects\n-- ========================"
},
{
"path": "sql/14.12/extra/update.sql",
"chars": 28021,
"preview": "--\n-- UPDATE syntax tests\n--\n--Testcase 32:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 33:\nCREATE SERVER sqlite_svr FOREIGN"
},
{
"path": "sql/14.12/libsqlite.sql",
"chars": 311,
"preview": "-- Test for SQLite library code source and defaults\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nSELECT sqli"
},
{
"path": "sql/14.12/selectfunc.sql",
"chars": 14850,
"preview": "SET datestyle=ISO;\nSET timezone='Japan';\n\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER server1"
},
{
"path": "sql/14.12/sqlite_fdw.sql",
"chars": 31327,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 129:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/types/bitstring.sql",
"chars": 9084,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/types/bool.sql",
"chars": 6324,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 000:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/types/float4.sql",
"chars": 24834,
"preview": "--\n-- FLOAT4\n--\n--Testcase 46:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 47:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/14.12/types/float8.sql",
"chars": 36560,
"preview": "--\n-- FLOAT8\n--\n--Testcase 113:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 114:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPP"
},
{
"path": "sql/14.12/types/int4.sql",
"chars": 9251,
"preview": "--\n-- INT4 Based on PostgreSQL tests, please don't add additional tests here, use other test files\n--\n--Testcase 61:\nCRE"
},
{
"path": "sql/14.12/types/int8.sql",
"chars": 18113,
"preview": "--\n-- INT8\n-- Test int8 64-bit integers.\n--\n--Testcase 140:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 141:\nCREATE SERVER s"
},
{
"path": "sql/14.12/types/json.sql",
"chars": 221595,
"preview": "-- SET log_min_messages TO DEBUG3;\n-- SET client_min_messages TO DEBUG3;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/types/macaddr.sql",
"chars": 14211,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/types/macaddr8.sql",
"chars": 14962,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/types/numeric.sql",
"chars": 102309,
"preview": "--\n-- NUMERIC\n--\n--Testcase 567:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 568:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAP"
},
{
"path": "sql/14.12/types/out_of_range.sql",
"chars": 3598,
"preview": "--\n-- INT4 + INT2\n--\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 002:\nCREATE SERVER sqlite_svr FOREIGN DATA "
},
{
"path": "sql/14.12/types/timestamp.sql",
"chars": 4868,
"preview": "--\n-- TIMESTAMP\n--\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPE"
},
{
"path": "sql/14.12/types/uuid.sql",
"chars": 10381,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/14.12/with_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/14.12/with_gis_support/postgis.sql",
"chars": 105511,
"preview": "--Testcase 2:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 3:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/14.12/with_gis_support/type.sql",
"chars": 8418,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/14.12/without_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/14.12/without_gis_support/nogis.sql",
"chars": 8433,
"preview": "--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/14.12/without_gis_support/type.sql",
"chars": 8376,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/15.7/aggregate.sql",
"chars": 2983,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/15.7/extra/aggregates.sql",
"chars": 68333,
"preview": "--\n-- AGGREGATES\n--\n--Testcase 266:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 267:\nCREATE SERVER sqlite_svr FOREIGN DATA W"
},
{
"path": "sql/15.7/extra/encodings.sql",
"chars": 227792,
"preview": "-- tests for PR #76 github\n-- see https://www.postgresql.org/docs/current/multibyte.html\n-- EUC_CN, not tested\n-- EUC_JP"
},
{
"path": "sql/15.7/extra/insert.sql",
"chars": 26549,
"preview": "--\n-- insert with DEFAULT in the target_list\n--\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 17:\nCREATE SERVER"
},
{
"path": "sql/15.7/extra/join.sql",
"chars": 82667,
"preview": "--\n-- JOIN\n-- Test JOIN clauses\n--\n--Testcase 360:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 361:\nCREATE SERVER sqlite_svr"
},
{
"path": "sql/15.7/extra/limit.sql",
"chars": 11435,
"preview": "--\n-- LIMIT\n-- Check the LIMIT/OFFSET feature of SELECT\n--\n--Testcase 27:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 28:\nCR"
},
{
"path": "sql/15.7/extra/prepare.sql",
"chars": 3616,
"preview": "-- Regression tests for prepareable statements. We query the content\n-- of the pg_prepared_statements view as prepared s"
},
{
"path": "sql/15.7/extra/select.sql",
"chars": 10970,
"preview": "--\n-- SELECT\n--\n--Testcase 43:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 44:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/15.7/extra/select_having.sql",
"chars": 2438,
"preview": "--\n-- SELECT_HAVING\n--\n\n--Testcase 22:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 23:\nCREATE SERVER sqlite_svr FOREIGN DATA"
},
{
"path": "sql/15.7/extra/sqlite_fdw_post.sql",
"chars": 168039,
"preview": "-- ===================================================================\n-- create FDW objects\n-- ========================"
},
{
"path": "sql/15.7/extra/update.sql",
"chars": 28021,
"preview": "--\n-- UPDATE syntax tests\n--\n--Testcase 32:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 33:\nCREATE SERVER sqlite_svr FOREIGN"
},
{
"path": "sql/15.7/libsqlite.sql",
"chars": 311,
"preview": "-- Test for SQLite library code source and defaults\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nSELECT sqli"
},
{
"path": "sql/15.7/selectfunc.sql",
"chars": 14850,
"preview": "SET datestyle=ISO;\nSET timezone='Japan';\n\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER server1"
},
{
"path": "sql/15.7/sqlite_fdw.sql",
"chars": 31327,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 129:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/types/bitstring.sql",
"chars": 9084,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/types/bool.sql",
"chars": 6324,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 000:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/types/float4.sql",
"chars": 24834,
"preview": "--\n-- FLOAT4\n--\n--Testcase 46:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 47:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/15.7/types/float8.sql",
"chars": 36560,
"preview": "--\n-- FLOAT8\n--\n--Testcase 113:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 114:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPP"
},
{
"path": "sql/15.7/types/int4.sql",
"chars": 9251,
"preview": "--\n-- INT4 Based on PostgreSQL tests, please don't add additional tests here, use other test files\n--\n--Testcase 61:\nCRE"
},
{
"path": "sql/15.7/types/int8.sql",
"chars": 18113,
"preview": "--\n-- INT8\n-- Test int8 64-bit integers.\n--\n--Testcase 140:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 141:\nCREATE SERVER s"
},
{
"path": "sql/15.7/types/json.sql",
"chars": 221595,
"preview": "-- SET log_min_messages TO DEBUG3;\n-- SET client_min_messages TO DEBUG3;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/types/macaddr.sql",
"chars": 14211,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/types/macaddr8.sql",
"chars": 14962,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/types/numeric.sql",
"chars": 105704,
"preview": "--\n-- NUMERIC\n--\n--Testcase 567:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 568:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAP"
},
{
"path": "sql/15.7/types/out_of_range.sql",
"chars": 3598,
"preview": "--\n-- INT4 + INT2\n--\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 002:\nCREATE SERVER sqlite_svr FOREIGN DATA "
},
{
"path": "sql/15.7/types/timestamp.sql",
"chars": 4868,
"preview": "--\n-- TIMESTAMP\n--\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPE"
},
{
"path": "sql/15.7/types/uuid.sql",
"chars": 10381,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/15.7/with_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/15.7/with_gis_support/postgis.sql",
"chars": 105511,
"preview": "--Testcase 2:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 3:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/15.7/with_gis_support/type.sql",
"chars": 8418,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/15.7/without_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/15.7/without_gis_support/nogis.sql",
"chars": 8433,
"preview": "--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/15.7/without_gis_support/type.sql",
"chars": 8376,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/16.3/aggregate.sql",
"chars": 2983,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/16.3/extra/aggregates.sql",
"chars": 68408,
"preview": "--\n-- AGGREGATES\n--\n--Testcase 266:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 267:\nCREATE SERVER sqlite_svr FOREIGN DATA W"
},
{
"path": "sql/16.3/extra/encodings.sql",
"chars": 227792,
"preview": "-- tests for PR #76 github\n-- see https://www.postgresql.org/docs/current/multibyte.html\n-- EUC_CN, not tested\n-- EUC_JP"
},
{
"path": "sql/16.3/extra/insert.sql",
"chars": 26549,
"preview": "--\n-- insert with DEFAULT in the target_list\n--\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 17:\nCREATE SERVER"
},
{
"path": "sql/16.3/extra/join.sql",
"chars": 99999,
"preview": "--\n-- JOIN\n-- Test JOIN clauses\n--\n--Testcase 360:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 361:\nCREATE SERVER sqlite_svr"
},
{
"path": "sql/16.3/extra/limit.sql",
"chars": 11435,
"preview": "--\n-- LIMIT\n-- Check the LIMIT/OFFSET feature of SELECT\n--\n--Testcase 27:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 28:\nCR"
},
{
"path": "sql/16.3/extra/prepare.sql",
"chars": 3787,
"preview": "-- Regression tests for prepareable statements. We query the content\n-- of the pg_prepared_statements view as prepared s"
},
{
"path": "sql/16.3/extra/select.sql",
"chars": 10969,
"preview": "--\n-- SELECT\n--\n--Testcase 43:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 44:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/16.3/extra/select_having.sql",
"chars": 2438,
"preview": "--\n-- SELECT_HAVING\n--\n\n--Testcase 22:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 23:\nCREATE SERVER sqlite_svr FOREIGN DATA"
},
{
"path": "sql/16.3/extra/sqlite_fdw_post.sql",
"chars": 180861,
"preview": "-- ===================================================================\n-- create FDW objects\n-- ========================"
},
{
"path": "sql/16.3/extra/update.sql",
"chars": 28021,
"preview": "--\n-- UPDATE syntax tests\n--\n--Testcase 32:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 33:\nCREATE SERVER sqlite_svr FOREIGN"
},
{
"path": "sql/16.3/libsqlite.sql",
"chars": 311,
"preview": "-- Test for SQLite library code source and defaults\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nSELECT sqli"
},
{
"path": "sql/16.3/selectfunc.sql",
"chars": 14850,
"preview": "SET datestyle=ISO;\nSET timezone='Japan';\n\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER server1"
},
{
"path": "sql/16.3/sqlite_fdw.sql",
"chars": 31300,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 129:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/types/bitstring.sql",
"chars": 9084,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/types/bool.sql",
"chars": 6324,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 000:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/types/float4.sql",
"chars": 25448,
"preview": "--\n-- FLOAT4\n--\n--Testcase 46:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 47:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/16.3/types/float8.sql",
"chars": 37692,
"preview": "--\n-- FLOAT8\n--\n--Testcase 113:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 114:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPP"
},
{
"path": "sql/16.3/types/int4.sql",
"chars": 14643,
"preview": "--\n-- INT4 Based on PostgreSQL tests, please don't add additional tests here, use other test files\n--\n--Testcase 61:\nCRE"
},
{
"path": "sql/16.3/types/int8.sql",
"chars": 23715,
"preview": "--\n-- INT8\n-- Test int8 64-bit integers.\n--\n--Testcase 140:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 141:\nCREATE SERVER s"
},
{
"path": "sql/16.3/types/json.sql",
"chars": 221595,
"preview": "-- SET log_min_messages TO DEBUG3;\n-- SET client_min_messages TO DEBUG3;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/types/macaddr.sql",
"chars": 14211,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/types/macaddr8.sql",
"chars": 14962,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/types/numeric.sql",
"chars": 110560,
"preview": "--\n-- NUMERIC\n--\n--Testcase 567:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 568:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAP"
},
{
"path": "sql/16.3/types/out_of_range.sql",
"chars": 3598,
"preview": "--\n-- INT4 + INT2\n--\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 002:\nCREATE SERVER sqlite_svr FOREIGN DATA "
},
{
"path": "sql/16.3/types/timestamp.sql",
"chars": 4868,
"preview": "--\n-- TIMESTAMP\n--\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPE"
},
{
"path": "sql/16.3/types/uuid.sql",
"chars": 10381,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/16.3/with_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/16.3/with_gis_support/postgis.sql",
"chars": 105511,
"preview": "--Testcase 2:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 3:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/16.3/with_gis_support/type.sql",
"chars": 8418,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/16.3/without_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/16.3/without_gis_support/nogis.sql",
"chars": 8433,
"preview": "--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/16.3/without_gis_support/type.sql",
"chars": 8376,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/17.0/aggregate.sql",
"chars": 2983,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/17.0/extra/aggregates.sql",
"chars": 73290,
"preview": "--\n-- AGGREGATES\n--\n--Testcase 266:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 267:\nCREATE SERVER sqlite_svr FOREIGN DATA W"
},
{
"path": "sql/17.0/extra/encodings.sql",
"chars": 227792,
"preview": "-- tests for PR #76 github\n-- see https://www.postgresql.org/docs/current/multibyte.html\n-- EUC_CN, not tested\n-- EUC_JP"
},
{
"path": "sql/17.0/extra/insert.sql",
"chars": 29805,
"preview": "--\n-- insert with DEFAULT in the target_list\n--\n--Testcase 16:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 17:\nCREATE SERVER"
},
{
"path": "sql/17.0/extra/join.sql",
"chars": 103328,
"preview": "--\n-- JOIN\n-- Test JOIN clauses\n--\n--Testcase 360:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 361:\nCREATE SERVER sqlite_svr"
},
{
"path": "sql/17.0/extra/limit.sql",
"chars": 11434,
"preview": "--\n-- LIMIT\n-- Check the LIMIT/OFFSET feature of SELECT\n--\n--Testcase 27:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 28:\nCR"
},
{
"path": "sql/17.0/extra/prepare.sql",
"chars": 3787,
"preview": "-- Regression tests for prepareable statements. We query the content\n-- of the pg_prepared_statements view as prepared s"
},
{
"path": "sql/17.0/extra/select.sql",
"chars": 10970,
"preview": "--\n-- SELECT\n--\n--Testcase 43:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 44:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/17.0/extra/select_having.sql",
"chars": 2438,
"preview": "--\n-- SELECT_HAVING\n--\n\n--Testcase 22:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 23:\nCREATE SERVER sqlite_svr FOREIGN DATA"
},
{
"path": "sql/17.0/extra/sqlite_fdw_post.sql",
"chars": 189559,
"preview": "-- ===================================================================\n-- create FDW objects\n-- ========================"
},
{
"path": "sql/17.0/extra/update.sql",
"chars": 28152,
"preview": "--\n-- UPDATE syntax tests\n--\n--Testcase 32:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 33:\nCREATE SERVER sqlite_svr FOREIGN"
},
{
"path": "sql/17.0/libsqlite.sql",
"chars": 311,
"preview": "-- Test for SQLite library code source and defaults\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nSELECT sqli"
},
{
"path": "sql/17.0/selectfunc.sql",
"chars": 14850,
"preview": "SET datestyle=ISO;\nSET timezone='Japan';\n\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER server1"
},
{
"path": "sql/17.0/sqlite_fdw.sql",
"chars": 31299,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 129:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/types/bitstring.sql",
"chars": 9084,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/types/bool.sql",
"chars": 6324,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 000:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/types/float4.sql",
"chars": 25448,
"preview": "--\n-- FLOAT4\n--\n--Testcase 46:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 47:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER"
},
{
"path": "sql/17.0/types/float8.sql",
"chars": 37692,
"preview": "--\n-- FLOAT8\n--\n--Testcase 113:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 114:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPP"
},
{
"path": "sql/17.0/types/int4.sql",
"chars": 14642,
"preview": "--\n-- INT4 Based on PostgreSQL tests, please don't add additional tests here, use other test files\n--\n--Testcase 61:\nCRE"
},
{
"path": "sql/17.0/types/int8.sql",
"chars": 23886,
"preview": "--\n-- INT8\n-- Test int8 64-bit integers.\n--\n--Testcase 140:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 141:\nCREATE SERVER s"
},
{
"path": "sql/17.0/types/json.sql",
"chars": 221595,
"preview": "-- SET log_min_messages TO DEBUG3;\n-- SET client_min_messages TO DEBUG3;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/types/macaddr.sql",
"chars": 14211,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/types/macaddr8.sql",
"chars": 14962,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/types/numeric.sql",
"chars": 111756,
"preview": "--\n-- NUMERIC\n--\n--Testcase 567:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 568:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAP"
},
{
"path": "sql/17.0/types/out_of_range.sql",
"chars": 3598,
"preview": "--\n-- INT4 + INT2\n--\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 002:\nCREATE SERVER sqlite_svr FOREIGN DATA "
},
{
"path": "sql/17.0/types/timestamp.sql",
"chars": 7413,
"preview": "--\n-- TIMESTAMP\n--\n--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPE"
},
{
"path": "sql/17.0/types/uuid.sql",
"chars": 10381,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 001:\nCREATE EXTENSION sqlite_fdw;\n--"
},
{
"path": "sql/17.0/with_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/17.0/with_gis_support/postgis.sql",
"chars": 105511,
"preview": "--Testcase 2:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 3:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/17.0/with_gis_support/type.sql",
"chars": 8418,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/17.0/without_gis_support/auto_import.sql",
"chars": 2019,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 01:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/17.0/without_gis_support/nogis.sql",
"chars": 8433,
"preview": "--Testcase 1:\nCREATE EXTENSION sqlite_fdw;\n--Testcase 2:\nCREATE SERVER sqlite_svr FOREIGN DATA WRAPPER sqlite_fdw\nOPTION"
},
{
"path": "sql/17.0/without_gis_support/type.sql",
"chars": 8376,
"preview": "--SET log_min_messages TO DEBUG1;\n--SET client_min_messages TO DEBUG1;\n--Testcase 44:\nCREATE EXTENSION sqlite_fdw;\n--T"
},
{
"path": "sql/init_data/agg.data",
"chars": 38,
"preview": "56\t7.8\n100\t99.097\n0\t0.09561\n42\t324.78\n"
},
{
"path": "sql/init_data/datetimes.data",
"chars": 127,
"preview": "FirstDate\t2020-05-12 11:45:31\t1589283931\r\nSecondDate\t2020-05-12 13:32:31\t1589290351\r\nThirdDate\t2020-05-10 10:45:29\t15891"
},
{
"path": "sql/init_data/init.sql",
"chars": 9190,
"preview": "\nDROP TABLE IF EXISTS department;\nDROP TABLE IF EXISTS employee;\nDROP TABLE IF EXISTS empdata;\nDROP TABLE IF EXISTS numb"
},
{
"path": "sql/init_data/init_core.sql",
"chars": 12926,
"preview": ".mode csv\n\nDROP TABLE IF EXISTS FLOAT4_TBL;\nDROP TABLE IF EXISTS FLOAT4_TMP;\nDROP TABLE IF EXISTS FLOAT8_TBL;\nDROP TABLE"
},
{
"path": "sql/init_data/init_post.sql",
"chars": 3236,
"preview": "DROP TABLE IF EXISTS \"T 0\";\nDROP TABLE IF EXISTS \"T 1\";\nDROP TABLE IF EXISTS \"T 2\";\nDROP TABLE IF EXISTS \"T 3\";\nDROP TAB"
},
{
"path": "sql/init_data/init_selectfunc.sql",
"chars": 865,
"preview": "\nDROP TABLE IF EXISTS s3;\nCREATE TABLE s3(id text primary key, time timestamp, tag1 text, value1 float, value2 int, valu"
},
{
"path": "sql/init_data/onek.data",
"chars": 58300,
"preview": "147\t0\t1\t3\t7\t7\t7\t47\t147\t147\t147\t14\t15\tRFAAAA\tAAAAAA\tAAAAxx\n931\t1\t1\t3\t1\t11\t1\t31\t131\t431\t931\t2\t3\tVJAAAA\tBAAAAA\tHHHHxx\n714\t2"
},
{
"path": "sql/init_data/person.data",
"chars": 996,
"preview": "mike\t40\t(3.1,6.2)\njoe\t20\t(5.5,2.5)\nsally\t34\t(3.8,45.8)\nsandra\t19\t(9.345,09.6)\nalex\t30\t(1.352,8.2)\nsue\t50\t(8.34,7.375)\nde"
},
{
"path": "sql/init_data/streets.data",
"chars": 408540,
"preview": "A St \t[(-122.0265,37.049),(-122.0271,37.045)]\nA St \t[(-122.089"
},
{
"path": "sql/init_data/student.data",
"chars": 87,
"preview": "fred\t28\t(3.1,-1.5)\t3.70000000000000020e+00\nlarry\t60\t(21.8,4.9)\t3.10000000000000010e+00\n"
},
{
"path": "sql/init_data/tenk.data",
"chars": 670800,
"preview": "8800\t0\t0\t0\t0\t0\t0\t800\t800\t3800\t8800\t0\t1\tMAAAAA\tAAAAAA\tAAAAxx\n1891\t1\t1\t3\t1\t11\t91\t891\t1891\t1891\t1891\t182\t183\tTUAAAA\tBAAAAA\t"
},
{
"path": "sqlite_data_norm.c",
"chars": 20810,
"preview": "/*-------------------------------------------------------------------------\n *\n * SQLite Foreign Data Wrapper for Postgr"
},
{
"path": "sqlite_fdw--1.0--1.1.sql",
"chars": 1547,
"preview": "/* contrib/sqlite_fdw/sqlite_fdw--1.0--1.1.sql */\n\n-- complain if script is sourced in psql, rather than via ALTER EXTEN"
}
]
// ... and 8 more files (download for full content)
About this extraction
This page contains the full source code of the pgspider/sqlite_fdw GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 208 files (7.8 MB), approximately 2.0M tokens, and a symbol index with 2078 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.