Skip to content

Non-breakable refactoring according postgres_fdw before initial RETURNING implementation #107

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ GIS_DEP_TESTS = $(GIS_DEP_TESTS_DIR)/type $(GIS_DEP_TESTS_DIR)/auto_import $(GIS

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)
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 extra/returning $(GIS_DEP_TESTS)
endif

# Other encodings also are tested. Client encoding should be UTF-8.
Expand Down
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Features
- 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 `INSERT` ... `ON CONFLICT DO NOTHING`
- Support `WITH CHECK OPTION` views after a foreign table
- 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),
Expand All @@ -60,7 +61,7 @@ Features

### Pushing down
- `WHERE` clauses are pushdowned
- Aggregate function are pushdowned
- Some aggregate functions are pushdowned
- `ORDER BY` is pushdowned
- Joins (left/right/inner/cross/semi) are pushdowned
- `CASE` expressions are pushdowned.
Expand Down Expand Up @@ -744,6 +745,13 @@ funct_name (type arg ...)
}
}
```

To debug, you need to build PostgreSQL in debug mode. Use the following options.
```bash
./configure --prefix=<path_to_postgresql_build_folder> --enable-cassert --enable-debug CFLAGS="-ggdb -O0 -g3 -fno-omit-frame-pointer"
```
Also please refer https://wiki.postgresql.org/wiki/Developer_FAQ#What_debugging_features_are_available.3F

Useful links
------------

Expand Down
14 changes: 8 additions & 6 deletions connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ sqlite_get_connection(ForeignServer *server, bool truncatable)
}

/*
* sqlite_open_db
* Open remote sqlite database using specified database path
* and flags of opened file descriptor mode.
*/
Expand Down Expand Up @@ -230,7 +231,7 @@ sqlite_make_new_connection(ConnCacheEntry *entry, ForeignServer *server)
{
const char *dbpath = NULL;
ListCell *lc;
int flags = 0;
int flags = 0;

Assert(entry->conn == NULL);

Expand Down Expand Up @@ -389,9 +390,9 @@ sqlite_begin_remote_xact(ConnCacheEntry *entry)
}
}


/*
* Report an SQLite execution error.
* sqlitefdw_report_error
* Report an sqlite execution error
*/
void
sqlitefdw_report_error(int elevel, sqlite3_stmt * stmt, sqlite3 * conn,
Expand All @@ -401,7 +402,7 @@ sqlitefdw_report_error(int elevel, sqlite3_stmt * stmt, sqlite3 * conn,
int erc = sqlite3_extended_errcode(conn);
int sqlstate = ERRCODE_FDW_ERROR;

/* copy sql before callling another SQLite API */
/* copy sql before calling another SQLite API */
if (message)
message = pstrdup(message);

Expand All @@ -420,7 +421,8 @@ sqlitefdw_report_error(int elevel, sqlite3_stmt * stmt, sqlite3 * conn,
}

/*
* sqlitefdw_xact_callback --- cleanup at main-transaction end.
* sqlitefdw_xact_callback
* cleanup at main-transaction end.
*/
static void
sqlitefdw_xact_callback(XactEvent event, void *arg)
Expand Down Expand Up @@ -1038,7 +1040,7 @@ sqlite_cache_stmt(ForeignServer *server, sqlite3_stmt * *stmt)
}

/*
* finalize all sqlite statement
* finalize all SQLite statement
*/
static void
sqlite_finalize_list_stmt(List **list)
Expand Down
Loading