super-graph/core/internal/psql
Hiram Chirino 4cf7956ff5
feat: add cockroachdb support. (#50)
This PR changes the generated SQL so that it's also compatible with CockroachDB.
Notable changes:
* use `SELECT to_jsonb("__sr_0".*)`  instead of `SELECT to_jsonb("__sr_0")`
* don't use `json_populate_record`, use the `CAST` and `->>` instead.  For example:

  instead of: `SELECT "t"."full_name", "t"."email" FROM "_sg_input" i, json_populate_record(NULL::users, i.j) t`

  do: `CAST( i.j ->>'full_name' AS character varying), CAST( i.j ->>'email' AS character varying) FROM "_sg_input" i`

This PR also adds some integration tests against an actual database instance.  If you have the cockroachdb binary installed on your PATH,
the test suite will startup a temporary cockroachdb instance on a random port to test against.  It is stopped and the tmp data files are deleted once the test ends.  It will also run the integration tests against database
pointed at by your `SG_POSTGRESQL_TEST_URL` environment variable if it’s set.

Also includes some small formatting changes introduced by `gofmt -w .`
2020-04-18 17:42:17 -04:00
..
bench.0 Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
bench.8 Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
columns.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
fuzz.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
insert.go feat: add cockroachdb support. (#50) 2020-04-18 17:42:17 -04:00
insert_test.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
mutate.go feat: add cockroachdb support. (#50) 2020-04-18 17:42:17 -04:00
mutate_test.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
pprof_cpu.sh Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
pprof_mem.sh Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
psql_test.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
query.go feat: add cockroachdb support. (#50) 2020-04-18 17:42:17 -04:00
query_test.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
schema.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
stack_int.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
strings.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
tables.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
test_schema.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
tests.sql feat: add cockroachdb support. (#50) 2020-04-18 17:42:17 -04:00
update.go feat: add cockroachdb support. (#50) 2020-04-18 17:42:17 -04:00
update_test.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00
utils.go Refactor Super Graph into a library #26 2020-04-10 02:27:43 -04:00