{"data":{"mdx":{"code":{"body":"function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\n\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\n\nreturn class MDXContent extends React.Component {\n  constructor(props) {\n    super(props);\n    this.layout = null;\n  }\n\n  render() {\n    const _this$props = this.props,\n          {\n      components\n    } = _this$props,\n          props = _objectWithoutProperties(_this$props, [\"components\"]);\n\n    return React.createElement(MDXTag, {\n      name: \"wrapper\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"h1\",\n      components: components\n    }, `PostgreSQL`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `We are heavy database users at Uniregisty, but I'm no professional Database Administrator.`), React.createElement(MDXTag, {\n      name: \"h2\",\n      components: components\n    }, `Cool tricks`), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"h3\"\n    }, `pgcli`)), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `pgcli`), ` is a major improvement over the stock `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"p\"\n    }, `pshell`), `. Queries are auto-completed as you type and it's especially useful to complete complex joins. `), React.createElement(MDXTag, {\n      name: \"h3\",\n      components: components\n    }, `Debugging stored procedures`), React.createElement(MDXTag, {\n      name: \"p\",\n      components: components\n    }, `If you're writing complex stored procedures - maybe involving the JSON(B) field types with a lot of new operators - it can be helpful to debug your stored procedures. `), React.createElement(MDXTag, {\n      name: \"ol\",\n      components: components\n    }, React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ol\"\n    }, `It might be easier to run a Stored Procedure / DB Function using the `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `psql`), ` / `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `pgcli`), ` shell than from your client code, but I have written `, React.createElement(MDXTag, {\n      name: \"inlineCode\",\n      components: components,\n      parentName: \"li\"\n    }, `Python`), ` tests just to test a specific SQL query and hooked up a \"test watcher\" to also watch the SQL files, replace the functions/procedures and run the corresponding tests.`), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ol\"\n    }, `The obvious way to do debug is with exception messages/notices. Depending on the error level this will either end the current transaction and your ORM will surface the error in your application (or the psql shell) or you will have to inspect your database's logs.`), React.createElement(MDXTag, {\n      name: \"li\",\n      components: components,\n      parentName: \"ol\"\n    })));\n  }\n\n}"},"frontmatter":{"type":null,"dates":null,"org":null,"detail":null,"tech":null,"role":null}}},"pageContext":{"id":"a0d14bcd-05d6-50ee-8301-b4e5e4035a2d","slug":"/tech/postgresql"}}