顯示具有 postgres 標籤的文章。 顯示所有文章
顯示具有 postgres 標籤的文章。 顯示所有文章

2010年1月31日 星期日

postgre 數字檢查可用

CREATE OR REPLACE FUNCTION is_numeric(text)
RETURNS BOOLEAN AS
$BODY$

SELECT $1 ~ '^[-+]?[0-9]*[.]?[0-9]+$';

$BODY$
LANGUAGE 'sql' VOLATILE;

參考http://codeblox.net/block/184/

2009年10月7日 星期三

Postgre 忘記密碼

修改pg_hba.conf如下:
# IPv4 local connections:
host all all 127.0.0.1/32 md5
md5換成trust後重啟

執行要換的密碼:
psql -d template1 -U postgres -c "alter role postgres password ‘xxxx’;