<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>yohei-a</author_name>
  <author_url>https://blog.hatena.ne.jp/yohei-a/</author_url>
  <blog_title>ablog</blog_title>
  <blog_url>https://yohei-a.hatenablog.jp/</blog_url>
  <categories>
    <anon>PostgreSQL</anon>
    <anon>Redshift</anon>
  </categories>
  <description>psql でコマンドラインから変数を渡して SQL 内で参照する方法。 -v オプションで変数を渡し、 psql -v query_id=54321 ... SQL 内では :変数名 で渡された変数を参照する。 select * from SVL_QUERY_METRICS_SUMMARY where query = :query_id; 実装例 yoheia/aws/redshift/get_redshift_query_perf2 at master · yoheia/yoheia · GitHub 参考 -v assignment --set=assignment --variable=…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fyohei-a.hatenablog.jp%2Fentry%2F20250104%2F1735968454&quot; title=&quot;psql でコマンドラインから変数を渡して SQL 内で参照する - ablog&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2025-01-04 14:27:34</published>
  <title>psql でコマンドラインから変数を渡して SQL 内で参照する</title>
  <type>rich</type>
  <url>https://yohei-a.hatenablog.jp/entry/20250104/1735968454</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
