データベース応用 第 10 回 (学習アルゴリズム) 「PostgresQL と画像」 講義ノート目次

bytea 型で、1 GB まで直接データベースにしまうことができる。

ta05001=> create table qrcode (name text, image bytea);
CREATE TABLE
ta05001=> insert into qrcode values ('qr_email','qr_email.png');
INSERT 0 1
ta05001=> select * from qrcode;
   name   |           image            
----------+----------------------------
 qr_email | \x71725f656d61696c2e706e67
(1 row)

呼び出す dir にはこの画像がある。画像の呼び出しかたは以下のとおり。

ta05001=> select decode(name,'escape') from qrcode where name='qr_email';
       decode       
--------------------
 \x71725f656d61696c
(1 row)

地図情報は PostGIS をインストールし、利用することができる。