【ruby】後置 while について調べてみました ものづくりのブログ【ruby】後置 while について調べてみました – ものづくりのブログhttps://a1026302.hatenablog.com/entry/2022/05/23/192710先日対応してコードに 後置 while が使われていたので、挙動が把握できず調べてみたのでここにメモします。 コード 実行 気がついたこと コード def sample i = 0 begin foo = 10 puts ("sample:#{i}") i += 1 end while i < foo end 実行 irb(main):054:0> sample sample:0 sample:1 sample:2 sample:3 sample:4 sample:5 sample:6 sample:7 sample:8 sample:9 => nil 気がついたこと while は必ず1回は… 続きを読む 2022年5月23日2023年6月17日ブログruby
PostgreSQL でユーザ一覧とロール一覧を表示する方法 ものづくりのブログPostgreSQL でユーザ一覧を表示する方法 – ものづくりのブログhttps://a1026302.hatenablog.com/entry/2022/05/01/000000PostgreSQL でユーザ一覧は以下のコマンドで表示させます。 方法1 select usename from pg_user; 方法2 \du 続きを読む 2022年5月1日2023年6月17日ブログDB, postgresql
PostgreSQL でユーザ一覧とロール一覧を表示する方法 ものづくりのブログPostgreSQL でユーザ一覧を表示する方法 – ものづくりのブログhttps://a1026302.hatenablog.com/entry/2022/05/01/000000PostgreSQL でユーザ一覧は以下のコマンドで表示させます。 方法1 select usename from pg_user; 方法2 \du 続きを読む 2022年5月1日2023年6月9日ブログDB, postgresql
python で json -> csv 変換 ものづくりのブログpython で json -> csv 変換 – ものづくりのブログhttps://a1026302.hatenablog.com/entry/2022/04/29/231219python を使って json から csv に変換させたい場合のメモをここに残します。 データ 入力データ(json) 出力データ(csv) プログラム データ 入力データ(json) 入力データは以下のものを想定してます。 { "template": } … 続きを読む 2022年4月29日2023年6月17日ブログpython
postgresql の where 句で型の指定方法が悪くてエラーが出た ものづくりのブログpostgresql の where 句で型の指定方法が悪くてエラーが出た – ものづくりのブログhttps://a1026302.hatenablog.com/entry/2022/04/21/203314いつの間にか postgresql の型のチェックが厳しくなっていました。 症状 クエリ エラー 調査 エラーになる場合 int 型に文字列で検索 text 型に数値で検索 症状 クエリ 以下の SQL を実行したところエラーになりました。 select {{id}} from {{table}} where {{id}}=123 エラー ERROR: operator does not exist: character varying = integer LINE 1: …ect {{id}} from {{table}} where {{id}}=123; HINT: No opera… 続きを読む 2022年4月21日2023年6月17日ブログDB, postgresql