CREATE OR REPLACE FUNCTION autoGenFeature_function() RETURNS text AS$$DECLAREb_count int;beacon_id int;_total int; BEGINselect count(*) into b_count from beacon;_total := b_count;while b_count>0 loopselect pid into beacon_id from beacon
CREATE OR REPLACE FUNCTION isdigit(text) returns BOOLEAN AS 'select $1 ~ ''^(-)?[0-9]+$'' as result' LANGUAGE sql; --test functionSELECT isdigit('1') --return trueSELECT isdigit('A') --return false CREATE OR REPLACE FUNCTION isString(text) returns
資料量今後會很大/你無法預測 資料量會多大,建議換postgresql. mysql 在一定量資料後(一般觀點是 mysql 單表 200-300萬 時效能最好,資料再多效能就開始下降),效能下降很快,且大資料量情況下,mysql 穩定性/資料可靠性是問題。 postgresql 8.2 的官方說明如下: http://www.postgresql.org/about/ QUOTE: Limit Value Maximum Database Size Unlimited Maximum
NameALTER TABLE -- change the definition of a tableSynopsisALTER TABLE [ ONLY ] name [ * ] action [, ... ]ALTER TABLE [ ONLY ] name [ * ] RENAME [ COLUMN ] column TO new_columnALTER TABLE name RENAME TO new_nameALTER TABLE name SET
PostgreSQL是通過角色來管理資料庫存取權限的,我們可以將一個角色看成是一個資料庫使用者,或者一組資料庫使用者。角色可以擁有資料庫物件,如表、索引,也可以把這些對象上的許可權賦予其它角色,以控制哪些使用者對哪些對象擁有哪些許可權。 一、資料庫角色: 1. 建立角色: CREATE ROLE role_name; 2. 刪除角色: DROP ROLE role_name; 3. 查詢角色: 檢查系統資料表pg_role,如:
關於Linux AS4 自啟動Postgresql日誌出現Do you want to choose a different one?問題解決辦法OS:Linux AS4U2DB:Posgresql 8.1 按照PG的安裝說明,將postgresql指令碼copy到/etc/init.d/目錄下,執行chkconfig --add postgresql後,在系統中運行service postgresql