<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>suusanex</author_name>
  <author_url>https://blog.hatena.ne.jp/suusanex/</author_url>
  <blog_title>新しもの好きプログラマの耳より情報ブログ</blog_title>
  <blog_url>https://suusanex.hatenablog.jp/</blog_url>
  <categories>
  </categories>
  <description>概要 PostgreSQLでプログラム上から単発のSQLを実行したい場合に、ファイルを経由せずに1回限りのパスワードを与える方法の話です。 最初に結論まとめ コマンドプロンプトの/cのセッション内で環境変数を設定し、そのままコマンドも実行します。例えば次のようになります。 cmd /c &quot;set PGPASSWORD=user1password&amp;&amp;psql.exe --username=user1 --dbname=postgres --command=&quot;CREATE DATABASE database1'&quot;&quot; 話の背景 PostgreSQLでpsql.exeを使って、--commandオプシ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fsuusanex.hatenablog.jp%2Fentry%2F2024%2F03%2F14%2F201732&quot; title=&quot;PostgreSQLでSQLをコマンド実行する場合に、1回限りのパスワード認証をする方法 - 新しもの好きプログラマの耳より情報ブログ&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>2024-03-14 20:17:32</published>
  <title>PostgreSQLでSQLをコマンド実行する場合に、1回限りのパスワード認証をする方法</title>
  <type>rich</type>
  <url>https://suusanex.hatenablog.jp/entry/2024/03/14/201732</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
