connectors-postgresql.asciidoc 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. [#es-connectors-postgresql]
  2. === Elastic PostgreSQL connector reference
  3. ++++
  4. <titleabbrev>PostgreSQL</titleabbrev>
  5. ++++
  6. // Attributes used in this file
  7. :service-name: PostgreSQL
  8. :service-name-stub: postgresql
  9. The _Elastic PostgreSQL connector_ is a connector for https://www.postgresql.org[PostgreSQL^].
  10. This connector is written in Python using the {connectors-python}[Elastic connector framework^].
  11. This connector uses the https://github.com/elastic/connectors/blob/{branch}/connectors/sources/generic_database.py[generic database connector source code^] (branch _{connectors-branch}_, compatible with Elastic _{minor-version}_).
  12. View the specific {connectors-python}/connectors/sources/{service-name-stub}.py[*source code* for this connector^] (branch _{connectors-branch}_, compatible with Elastic _{minor-version}_).
  13. .Choose your connector reference
  14. *******************************
  15. Are you using an Elastic managed connector on Elastic Cloud or a self-managed connector? Expand the documentation based on your deployment method.
  16. *******************************
  17. // //////// //// //// //// //// //// //// ////////
  18. // //////// NATIVE CONNECTOR REFERENCE ///////
  19. // //////// //// //// //// //// //// //// ////////
  20. [discrete#connectors-postgresql-native-connector-reference]
  21. === *Elastic managed connector (Elastic Cloud)*
  22. .View *Elastic managed connector* reference
  23. [%collapsible]
  24. ===============
  25. [discrete#connectors-postgresql-availability-prerequisites]
  26. ==== Availability and prerequisites
  27. This connector is available as an *Elastic managed connector* in Elastic versions *8.8.0 and later*.
  28. To use this connector natively in Elastic Cloud, satisfy all <<es-native-connectors,Elastic managed connector requirements>>.
  29. [discrete#connectors-postgresql-create-native-connector]
  30. ==== Create a {service-name} connector
  31. include::_connectors-create-native.asciidoc[]
  32. [discrete#connectors-postgresql-usage]
  33. ==== Usage
  34. To use this connector as an *Elastic managed connector*, use the *Connector* workflow.
  35. See <<es-native-connectors>>.
  36. [TIP]
  37. ====
  38. Users must set `track_commit_timestamp` to `on`.
  39. To do this, run `ALTER SYSTEM SET track_commit_timestamp = on;` in PostgreSQL server.
  40. ====
  41. For additional operations, see <<-esconnectors-usage>>.
  42. [NOTE]
  43. ====
  44. For an end-to-end example of the connector client workflow, see <<es-postgresql-connector-client-tutorial>>.
  45. ====
  46. [discrete#connectors-postgresql-compatibility]
  47. ==== Compatibility
  48. PostgreSQL versions 11 to 15 are compatible with the Elastic connector.
  49. [discrete#connectors-postgresql-configuration]
  50. ==== Configuration
  51. Set the following configuration fields:
  52. Host::
  53. The server host address where the PostgreSQL instance is hosted.
  54. Examples:
  55. +
  56. * `192.158.1.38`
  57. * `demo.instance.demo-region.demo.service.com`
  58. Port::
  59. The port where the PostgreSQL instance is hosted.
  60. Examples:
  61. +
  62. * `5432` (default)
  63. Username::
  64. The username of the PostgreSQL account.
  65. Password::
  66. The password of the PostgreSQL account.
  67. Database::
  68. Name of the PostgreSQL database.
  69. Examples:
  70. +
  71. * `employee_database`
  72. * `customer_database`
  73. Schema::
  74. The schema of the PostgreSQL database.
  75. Comma-separated List of Tables::
  76. A list of tables separated by commas.
  77. The PostgreSQL connector will fetch data from all tables present in the configured database, if the value is `*` .
  78. Default value is `*`.
  79. Examples:
  80. +
  81. * `table_1, table_2`
  82. * `*`
  83. +
  84. [WARNING]
  85. ====
  86. This field can be bypassed when using advanced sync rules.
  87. ====
  88. Enable SSL::
  89. Toggle to enable SSL verification.
  90. Disabled by default.
  91. SSL Certificate::
  92. Content of SSL certificate.
  93. If SSL is disabled, the `ssl_ca` value will be ignored.
  94. +
  95. .*Expand* to see an example certificate
  96. [%collapsible]
  97. ====
  98. ```
  99. -----BEGIN CERTIFICATE-----
  100. MIID+jCCAuKgAwIBAgIGAJJMzlxLMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNVBAYT
  101. AlVTMQwwCgYDVQQKEwNJQk0xFjAUBgNVBAsTDURlZmF1bHROb2RlMDExFjAUBgNV
  102. BAsTDURlZmF1bHRDZWxsMDExGTAXBgNVBAsTEFJvb3QgQ2VydGlmaWNhdGUxEjAQ
  103. BgNVBAMTCWxvY2FsaG9zdDAeFw0yMTEyMTQyMjA3MTZaFw0yMjEyMTQyMjA3MTZa
  104. MF8xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xFjAUBgNVBAsTDURlZmF1bHRO
  105. b2RlMDExFjAUBgNVBAsTDURlZmF1bHRDZWxsMDExEjAQBgNVBAMTCWxvY2FsaG9z
  106. dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMv5HCsJZIpI5zCy+jXV
  107. z6lmzNc9UcVSEEHn86h6zT6pxuY90TYeAhlZ9hZ+SCKn4OQ4GoDRZhLPTkYDt+wW
  108. CV3NTIy9uCGUSJ6xjCKoxClJmgSQdg5m4HzwfY4ofoEZ5iZQ0Zmt62jGRWc0zuxj
  109. hegnM+eO2reBJYu6Ypa9RPJdYJsmn1RNnC74IDY8Y95qn+WZj//UALCpYfX41hko
  110. i7TWD9GKQO8SBmAxhjCDifOxVBokoxYrNdzESl0LXvnzEadeZTd9BfUtTaBHhx6t
  111. njqqCPrbTY+3jAbZFd4RiERPnhLVKMytw5ot506BhPrUtpr2lusbN5svNXjuLeea
  112. MMUCAwEAAaOBoDCBnTATBgNVHSMEDDAKgAhOatpLwvJFqjAdBgNVHSUEFjAUBggr
  113. BgEFBQcDAQYIKwYBBQUHAwIwVAYDVR0RBE0wS4E+UHJvZmlsZVVVSUQ6QXBwU3J2
  114. MDEtQkFTRS05MDkzMzJjMC1iNmFiLTQ2OTMtYWI5NC01Mjc1ZDI1MmFmNDiCCWxv
  115. Y2FsaG9zdDARBgNVHQ4ECgQITzqhA5sO8O4wDQYJKoZIhvcNAQELBQADggEBAKR0
  116. gY/BM69S6BDyWp5dxcpmZ9FS783FBbdUXjVtTkQno+oYURDrhCdsfTLYtqUlP4J4
  117. CHoskP+MwJjRIoKhPVQMv14Q4VC2J9coYXnePhFjE+6MaZbTjq9WaekGrpKkMaQA
  118. iQt5b67jo7y63CZKIo9yBvs7sxODQzDn3wZwyux2vPegXSaTHR/rop/s/mPk3YTS
  119. hQprs/IVtPoWU4/TsDN3gIlrAYGbcs29CAt5q9MfzkMmKsuDkTZD0ry42VjxjAmk
  120. xw23l/k8RoD1wRWaDVbgpjwSzt+kl+vJE/ip2w3h69eEZ9wbo6scRO5lCO2JM4Pr
  121. 7RhLQyWn2u00L7/9Omw=
  122. -----END CERTIFICATE-----
  123. ```
  124. ====
  125. [discrete#connectors-postgresql-documents-syncs]
  126. ==== Documents and syncs
  127. * Tables must be owned by a PostgreSQL user.
  128. * Tables with no primary key defined are skipped.
  129. * To fetch the last updated time in PostgreSQL, `track_commit_timestamp` must be set to `on`.
  130. Otherwise, all data will be indexed in every sync.
  131. [NOTE]
  132. ====
  133. * Files bigger than 10 MB won't be extracted.
  134. * Permissions are not synced.
  135. **All documents** indexed to an Elastic deployment will be visible to **all users with access** to that Elastic Deployment.
  136. ====
  137. [discrete#connectors-postgresql-sync-rules]
  138. ==== Sync rules
  139. <<es-sync-rules-basic,Basic sync rules>> are identical for all connectors and are available by default.
  140. [discrete#connectors-postgresql-sync-rules-advanced]
  141. ===== Advanced sync rules
  142. [NOTE]
  143. ====
  144. A <<es-connectors-sync-types-full, full sync>> is required for advanced sync rules to take effect.
  145. ====
  146. Advanced sync rules are defined through a source-specific DSL JSON snippet.
  147. [discrete#connectors-postgresql-sync-rules-advanced-example-data]
  148. ====== Example data
  149. Here is some example data that will be used in the following examples.
  150. [discrete#connectors-postgresql-sync-rules-advanced-example-data-1]
  151. ======= `employee` table
  152. [cols="3*", options="header"]
  153. |===
  154. | emp_id | name | age
  155. | 3 | John | 28
  156. | 10 | Jane | 35
  157. | 14 | Alex | 22
  158. |===
  159. [discrete#connectors-postgresql-sync-rules-advanced-example-2]
  160. ======= `customer` table
  161. [cols="3*", options="header"]
  162. |===
  163. | c_id | name | age
  164. | 2 | Elm | 24
  165. | 6 | Pine | 30
  166. | 9 | Oak | 34
  167. |===
  168. [discrete#connectors-postgresql-sync-rules-advanced-examples]
  169. ====== Advanced sync rules examples
  170. [discrete#connectors-postgresql-sync-rules-advanced-examples-1]
  171. ======= Multiple table queries
  172. [source,js]
  173. ----
  174. [
  175. {
  176. "tables": [
  177. "employee"
  178. ],
  179. "query": "SELECT * FROM employee"
  180. },
  181. {
  182. "tables": [
  183. "customer"
  184. ],
  185. "query": "SELECT * FROM customer"
  186. }
  187. ]
  188. ----
  189. // NOTCONSOLE
  190. [discrete#connectors-postgresql-sync-rules-advanced-examples-1-id-columns]
  191. ======= Multiple table queries with `id_columns`
  192. In 8.15.0, we added a new optional `id_columns` field in our advanced sync rules for the PostgreSQL connector.
  193. Use the `id_columns` field to ingest tables which do not have a primary key. Include the names of unique fields so that the connector can use them to generate unique IDs for documents.
  194. [source,js]
  195. ----
  196. [
  197. {
  198. "tables": [
  199. "employee"
  200. ],
  201. "query": "SELECT * FROM employee",
  202. "id_columns": ["emp_id"]
  203. },
  204. {
  205. "tables": [
  206. "customer"
  207. ],
  208. "query": "SELECT * FROM customer",
  209. "id_columns": ["c_id"]
  210. }
  211. ]
  212. ----
  213. // NOTCONSOLE
  214. This example uses the `id_columns` field to specify the unique fields `emp_id` and `c_id` for the `employee` and `customer` tables, respectively.
  215. [discrete#connectors-postgresql-sync-rules-advanced-examples-2]
  216. ======= Filtering data with `WHERE` clause
  217. [source,js]
  218. ----
  219. [
  220. {
  221. "tables": ["employee"],
  222. "query": "SELECT * FROM employee WHERE emp_id > 5"
  223. }
  224. ]
  225. ----
  226. // NOTCONSOLE
  227. [discrete#connectors-postgresql-sync-rules-advanced-examples-3]
  228. ======= `JOIN` operations
  229. [source,js]
  230. ----
  231. [
  232. {
  233. "tables": ["employee", "customer"],
  234. "query": "SELECT * FROM employee INNER JOIN customer ON employee.emp_id = customer.c_id"
  235. }
  236. ]
  237. ----
  238. // NOTCONSOLE
  239. [WARNING]
  240. ====
  241. When using advanced rules, a query can bypass the configuration field `tables`.
  242. This will happen if the query specifies a table that doesn't appear in the configuration.
  243. This can also happen if the configuration specifies `*` to fetch all tables while the advanced sync rule requests for only a subset of tables.
  244. ====
  245. [discrete#connectors-postgresql-known-issues]
  246. ==== Known issues
  247. There are no known issues for this connector.
  248. Refer to <<es-connectors-known-issues>> for a list of known issues for all connectors.
  249. [discrete#connectors-postgresql-troubleshooting]
  250. ==== Troubleshooting
  251. See <<es-connectors-troubleshooting>>.
  252. [discrete#connectors-postgresql-security]
  253. ==== Security
  254. See <<es-connectors-security>>.
  255. // Closing the collapsible section
  256. ===============
  257. [discrete#es-connectors-postgresql-connector-client-reference]
  258. === *Self-managed connector*
  259. .View *self-managed connector* reference
  260. [%collapsible]
  261. ===============
  262. [discrete#es-connectors-postgresql-client-availability-prerequisites]
  263. ==== Availability and prerequisites
  264. This connector is available as a self-managed *self-managed connector*.
  265. To use this connector, satisfy all <<es-build-connector,self-managed connector requirements>>.
  266. [discrete#es-connectors-postgresql-create-connector-client]
  267. ==== Create a {service-name} connector
  268. include::_connectors-create-client.asciidoc[]
  269. [discrete#es-connectors-postgresql-client-usage]
  270. ==== Usage
  271. To use this connector as a *self-managed connector*, see <<es-build-connector>>.
  272. [TIP]
  273. ====
  274. Users must set `track_commit_timestamp` to `on`.
  275. To do this, run `ALTER SYSTEM SET track_commit_timestamp = on;` in PostgreSQL server.
  276. ====
  277. For additional operations, see.
  278. [NOTE]
  279. ====
  280. For an end-to-end example of the self-managed connector workflow, see <<es-postgresql-connector-client-tutorial>>.
  281. ====
  282. [discrete#es-connectors-postgresql-client-compatibility]
  283. ==== Compatibility
  284. PostgreSQL versions 11 to 15 are compatible with Elastic connector frameworks.
  285. [discrete#es-connectors-postgresql-client-configuration]
  286. ==== Configuration
  287. [TIP]
  288. ====
  289. When using the <<es-build-connector, self-managed connector workflow>>, initially these fields will use the default configuration set in the https://github.com/elastic/connectors-python/blob/{branch}/connectors/sources/postgresql.py[connector source code^].
  290. These configurable fields will be rendered with their respective *labels* in the Kibana UI.
  291. Once connected, users will be able to update these values in Kibana.
  292. ====
  293. Set the following configuration fields:
  294. `host`::
  295. The server host address where the PostgreSQL instance is hosted.
  296. Examples:
  297. +
  298. * `192.158.1.38`
  299. * `demo.instance.demo-region.demo.service.com`
  300. `port`::
  301. The port where the PostgreSQL instance is hosted.
  302. Examples:
  303. +
  304. * `5432`
  305. * `9090`
  306. `username`::
  307. The username of the PostgreSQL account.
  308. `password`::
  309. The password of the PostgreSQL account.
  310. `database`::
  311. Name of the PostgreSQL database.
  312. Examples:
  313. +
  314. * `employee_database`
  315. * `customer_database`
  316. `schema`::
  317. The schema of the PostgreSQL database.
  318. `tables`::
  319. A list of tables separated by commas.
  320. The PostgreSQL connector will fetch data from all tables present in the configured database, if the value is `*` .
  321. Default value is `*`.
  322. Examples:
  323. +
  324. * `table_1, table_2`
  325. * `*`
  326. +
  327. [WARNING]
  328. ====
  329. This field can be bypassed when using advanced sync rules.
  330. ====
  331. `ssl_enabled`::
  332. Whether SSL verification will be enabled.
  333. Default value is `True`.
  334. `ssl_ca`::
  335. Content of SSL certificate (if SSL is enabled).
  336. If SSL is disabled, the `ssl_ca` value will be ignored.
  337. +
  338. .*Expand* to see an example certificate
  339. [%collapsible]
  340. ====
  341. ```
  342. -----BEGIN CERTIFICATE-----
  343. MIID+jCCAuKgAwIBAgIGAJJMzlxLMA0GCSqGSIb3DQEBCwUAMHoxCzAJBgNVBAYT
  344. AlVTMQwwCgYDVQQKEwNJQk0xFjAUBgNVBAsTDURlZmF1bHROb2RlMDExFjAUBgNV
  345. BAsTDURlZmF1bHRDZWxsMDExGTAXBgNVBAsTEFJvb3QgQ2VydGlmaWNhdGUxEjAQ
  346. BgNVBAMTCWxvY2FsaG9zdDAeFw0yMTEyMTQyMjA3MTZaFw0yMjEyMTQyMjA3MTZa
  347. MF8xCzAJBgNVBAYTAlVTMQwwCgYDVQQKEwNJQk0xFjAUBgNVBAsTDURlZmF1bHRO
  348. b2RlMDExFjAUBgNVBAsTDURlZmF1bHRDZWxsMDExEjAQBgNVBAMTCWxvY2FsaG9z
  349. dDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMv5HCsJZIpI5zCy+jXV
  350. z6lmzNc9UcVSEEHn86h6zT6pxuY90TYeAhlZ9hZ+SCKn4OQ4GoDRZhLPTkYDt+wW
  351. CV3NTIy9uCGUSJ6xjCKoxClJmgSQdg5m4HzwfY4ofoEZ5iZQ0Zmt62jGRWc0zuxj
  352. hegnM+eO2reBJYu6Ypa9RPJdYJsmn1RNnC74IDY8Y95qn+WZj//UALCpYfX41hko
  353. i7TWD9GKQO8SBmAxhjCDifOxVBokoxYrNdzESl0LXvnzEadeZTd9BfUtTaBHhx6t
  354. njqqCPrbTY+3jAbZFd4RiERPnhLVKMytw5ot506BhPrUtpr2lusbN5svNXjuLeea
  355. MMUCAwEAAaOBoDCBnTATBgNVHSMEDDAKgAhOatpLwvJFqjAdBgNVHSUEFjAUBggr
  356. BgEFBQcDAQYIKwYBBQUHAwIwVAYDVR0RBE0wS4E+UHJvZmlsZVVVSUQ6QXBwU3J2
  357. MDEtQkFTRS05MDkzMzJjMC1iNmFiLTQ2OTMtYWI5NC01Mjc1ZDI1MmFmNDiCCWxv
  358. Y2FsaG9zdDARBgNVHQ4ECgQITzqhA5sO8O4wDQYJKoZIhvcNAQELBQADggEBAKR0
  359. gY/BM69S6BDyWp5dxcpmZ9FS783FBbdUXjVtTkQno+oYURDrhCdsfTLYtqUlP4J4
  360. CHoskP+MwJjRIoKhPVQMv14Q4VC2J9coYXnePhFjE+6MaZbTjq9WaekGrpKkMaQA
  361. iQt5b67jo7y63CZKIo9yBvs7sxODQzDn3wZwyux2vPegXSaTHR/rop/s/mPk3YTS
  362. hQprs/IVtPoWU4/TsDN3gIlrAYGbcs29CAt5q9MfzkMmKsuDkTZD0ry42VjxjAmk
  363. xw23l/k8RoD1wRWaDVbgpjwSzt+kl+vJE/ip2w3h69eEZ9wbo6scRO5lCO2JM4Pr
  364. 7RhLQyWn2u00L7/9Omw=
  365. -----END CERTIFICATE-----
  366. ```
  367. ====
  368. [discrete#es-connectors-postgresql-client-docker]
  369. ==== Deployment using Docker
  370. include::_connectors-docker-instructions.asciidoc[]
  371. [discrete#es-connectors-postgresql-client-documents-syncs]
  372. ==== Documents and syncs
  373. * Tables must be owned by a PostgreSQL user.
  374. * Tables with no primary key defined are skipped.
  375. * To fetch the last updated time in PostgreSQL, `track_commit_timestamp` must be set to `on`.
  376. Otherwise, all data will be indexed in every sync.
  377. [NOTE]
  378. ====
  379. * Files bigger than 10 MB won't be extracted.
  380. * Permissions are not synced.
  381. **All documents** indexed to an Elastic deployment will be visible to **all users with access** to that Elastic Deployment.
  382. ====
  383. [discrete#es-connectors-postgresql-client-sync-rules]
  384. ==== Sync rules
  385. //sync-rules-basic,Basic sync rules are identical for all connectors and are available by default.
  386. [discrete#es-connectors-postgresql-client-sync-rules-advanced]
  387. ===== Advanced sync rules
  388. [NOTE]
  389. ====
  390. A //connectors-sync-types-full, full sync is required for advanced sync rules to take effect.
  391. ====
  392. Advanced sync rules are defined through a source-specific DSL JSON snippet.
  393. [discrete#es-connectors-postgresql-client-sync-rules-advanced-example-data]
  394. ====== Example data
  395. Here is some example data that will be used in the following examples.
  396. [discrete#es-connectors-postgresql-client-sync-rules-advanced-example-data-1]
  397. ======= `employee` table
  398. [cols="3*", options="header"]
  399. |===
  400. | emp_id | name | age
  401. | 3 | John | 28
  402. | 10 | Jane | 35
  403. | 14 | Alex | 22
  404. |===
  405. [discrete#es-connectors-postgresql-client-sync-rules-advanced-example-2]
  406. ======= `customer` table
  407. [cols="3*", options="header"]
  408. |===
  409. | c_id | name | age
  410. | 2 | Elm | 24
  411. | 6 | Pine | 30
  412. | 9 | Oak | 34
  413. |===
  414. [discrete#es-connectors-postgresql-client-sync-rules-advanced-examples]
  415. ====== Advanced sync rules examples
  416. [discrete#es-connectors-postgresql-client-sync-rules-advanced-examples-1]
  417. ======== Multiple table queries
  418. [source,js]
  419. ----
  420. [
  421. {
  422. "tables": [
  423. "employee"
  424. ],
  425. "query": "SELECT * FROM employee"
  426. },
  427. {
  428. "tables": [
  429. "customer"
  430. ],
  431. "query": "SELECT * FROM customer"
  432. }
  433. ]
  434. ----
  435. // NOTCONSOLE
  436. [discrete#es-connectors-postgresql-client-sync-rules-advanced-examples-1-id-columns]
  437. ======== Multiple table queries with `id_columns`
  438. In 8.15.0, we added a new optional `id_columns` field in our advanced sync rules for the PostgreSQL connector.
  439. Use the `id_columns` field to ingest tables which do not have a primary key. Include the names of unique fields so that the connector can use them to generate unique IDs for documents.
  440. [source,js]
  441. ----
  442. [
  443. {
  444. "tables": [
  445. "employee"
  446. ],
  447. "query": "SELECT * FROM employee",
  448. "id_columns": ["emp_id"]
  449. },
  450. {
  451. "tables": [
  452. "customer"
  453. ],
  454. "query": "SELECT * FROM customer",
  455. "id_columns": ["c_id"]
  456. }
  457. ]
  458. ----
  459. // NOTCONSOLE
  460. This example uses the `id_columns` field to specify the unique fields `emp_id` and `c_id` for the `employee` and `customer` tables, respectively.
  461. [discrete#es-connectors-postgresql-client-sync-rules-advanced-examples-2]
  462. ======== Filtering data with `WHERE` clause
  463. [source,js]
  464. ----
  465. [
  466. {
  467. "tables": ["employee"],
  468. "query": "SELECT * FROM employee WHERE emp_id > 5"
  469. }
  470. ]
  471. ----
  472. // NOTCONSOLE
  473. [discrete#es-connectors-postgresql-client-sync-rules-advanced-examples-3]
  474. ======== `JOIN` operations
  475. [source,js]
  476. ----
  477. [
  478. {
  479. "tables": ["employee", "customer"],
  480. "query": "SELECT * FROM employee INNER JOIN customer ON employee.emp_id = customer.c_id"
  481. }
  482. ]
  483. ----
  484. // NOTCONSOLE
  485. [WARNING]
  486. ====
  487. When using advanced rules, a query can bypass the configuration field `tables`.
  488. This will happen if the query specifies a table that doesn't appear in the configuration.
  489. This can also happen if the configuration specifies `*` to fetch all tables while the advanced sync rule requests for only a subset of tables.
  490. ====
  491. [discrete#es-connectors-postgresql-client-client-operations-testing]
  492. ==== End-to-end testing
  493. The connector framework enables operators to run functional tests against a real data source.
  494. Refer to <<es-build-connector-testing>> for more details.
  495. To perform E2E testing for the PostgreSQL connector, run the following command:
  496. [source,shell]
  497. ----
  498. $ make ftest NAME=postgresql
  499. ----
  500. For faster tests, add the `DATA_SIZE=small` flag:
  501. [source,shell]
  502. ----
  503. make ftest NAME=postgresql DATA_SIZE=small
  504. ----
  505. [discrete#es-connectors-postgresql-client-known-issues]
  506. ==== Known issues
  507. There are no known issues for this connector.
  508. Refer to <<es-connectors-known-issues>> for a list of known issues for all connectors.
  509. [discrete#es-connectors-postgresql-client-troubleshooting]
  510. ==== Troubleshooting
  511. See <<es-connectors-troubleshooting>>.
  512. [discrete#es-connectors-postgresql-client-security]
  513. ==== Security
  514. See <<es-connectors-security>>.
  515. // Closing the collapsible section
  516. ===============