database.sarang.net
UserID
Passwd
Database
DBMS
MySQL
ㆍPostgreSQL
Firebird
Oracle
Informix
Sybase
MS-SQL
DB2
Cache
CUBRID
LDAP
ALTIBASE
Tibero
DB 문서들
스터디
Community
공지사항
자유게시판
구인|구직
DSN 갤러리
도움주신분들
Admin
운영게시판
최근게시물
PostgreSQL Q&A 3002 게시물 읽기
No. 3002
eval() for PostgreSQL
작성자
정재익
작성일
2001-06-22 08:00
조회수
1,961

Submitted on: 04-12-2001

Description:

Eval() for PostgreSQL. I used this so that I can dig into the default value for a column (in pg_attrdef), which gives me PostgreSQL expressions, like 'f'::bool or 3.5::float. This 'evaluates' that into the value that I can insert (via ODBC front-end) back into the database.

Code:

 

-- author: Joel Burton

-- license: public domain

 

CREATE FUNCTION eval(text) RETURNS text AS '

declare

b record;

q text;

begin

q := 'SELECT (' || $1 || ')::text as a';

for b in execute q loop

return b.a;

end loop;

end;

' language 'plpgsql';

[Top]
No.
제목
작성자
작성일
조회
3005pgMail -- TCL-based scripts
정재익
2001-06-22
2233
3004가장 근접한 ZIP code 찾기
정재익
2001-06-22
2548
3003Number of affected rows
정재익
2001-06-22
1932
3002eval() for PostgreSQL
정재익
2001-06-22
1961
3001Retrive comma separated PK attributes
정재익
2001-06-22
1907
3000Delete duplicate records in a table
정재익
2001-06-22
1910
2999Error catching
정재익
2001-06-21
1837
Valid XHTML 1.0!
All about the DATABASE... Copyleft 1999-2024 DSN, All rights reserved.
작업시간: 0.017초, 이곳 서비스는
	PostgreSQL v16.2로 자료를 관리합니다