TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Pg_yregress, Structured Testing for Postgres

56 pointsby yrashkover 1 year ago
Originally inspired by pg_regress, pg_yregress provides a TAP-compatible test executor that allows for better test organization, easier instance management, native JSON handling and so on.

8 comments

mdanielover 1 year ago
Fun fact: IJ has &quot;embedded language&quot; support, meaning it understands that some parts of yaml (and any other source code) are another source code and thus offers both syntax highlighting and its usual bunch of introspections. That may not be as meaningful for test SQL, since it probably doesn&#x27;t have a ton of existing schema against which it should check, but it undoubtedly is helpful when IJ is told this is the PostgreSQL dialect of SQL and thus is able to offer relevant completion and quick-doc for the functions<p>One can tell IJ what&#x27;s going on in one of two ways: comment markup or creating a JSON Schema for the yaml and placing x-intellij-language-injection metadata into the relevant elements<p><pre><code> tests: - #language=SQL query: select 1 as result results: - result: 1 </code></pre> or<p><pre><code> $id: pg_yregress $schema: &quot;http:&#x2F;&#x2F;json-schema.org&#x2F;draft-07&#x2F;schema#&quot; properties: tests: type: array items: $ref: &#x27;#&#x2F;definitions&#x2F;Test&#x27; definitions: Test: type: object properties: query: description: the test query to run type: string # https:&#x2F;&#x2F;github.com&#x2F;JetBrains&#x2F;intellij-community&#x2F;blob&#x2F;idea&#x2F;233.9802.14&#x2F;json&#x2F;src&#x2F;jsonSchema&#x2F;schema.json#L52 x-intellij-language-injection: SQL results: type: array item: type: object additionalProperties: true</code></pre>
评论 #37893434 未加载
rxrogover 1 year ago
This is such an interesting project. Having written SQL based tests with MTR, I really love the reusable queries and not having to dump the full SQL output into test results.
Deipayanover 1 year ago
I am fairly newbie to the Postgres ecosystem. Explain me like I am 5 how this is better than TAP - what pains precisely this addresses
评论 #37892930 未加载
vkakuover 1 year ago
This is great. Good to see standardized testing improvements to the pg_regress add-on. YAML does better than JSON when it comes to readability. To an extent, TOML as well.
评论 #37892697 未加载
weijun95over 1 year ago
Look like an interesting approach to handling YAML.
pilotdeveloperover 1 year ago
How does this compares to pgTAP? I&#x27;ve been using pgTAP for a long time, how is this better?
评论 #37893572 未加载
vira28over 1 year ago
As much as I don’t prefer YAML, this is a very good use case for it.
rohan_puriover 1 year ago
Looks interesting Yurii!