create function 중 internal 이라는 language 로서 함수를 만드는 것은 'postgres' 라는 superuser 만이 가능합니다. 그리고 internal 이라고 하는 것은 PostgreSQL 에서 기본적으로 제공되는 언어로 등록되어 있으며(SQL, internal, C 라는 세가지 언어가 등록되어 있습니다) 실제로 어떤 language compiler 를 가지는 것은 아닙니다. 단지 내부적으로 이용하기 위한 목적으로 생성되어 있습니다. 이 Internal 이라는 언어로 함수를 선언하기 위해서는 반드시 DB 의 superuser 권한을 가져야만이 가능합니다. 참고하시기 바랍니다.
참고로 선언한 언어의 사용법 예제를 알고 싶으면 다음 글과 댓글을 참조하시기 바랍니다.
http://database.sarang.net/board/dbdata.php3?table=dbdata&action=article&arg=240
>>이승현 님께서 쓰시길<<
:: CREATE FUNCTION abstime_datetime(int4)
:: RETURNS datetime
:: AS '/' LANGUAGE 'internal';
::
:: CREATE FUNCTION datetime(int4)
:: RETURNS datetime
:: AS 'select abstime_datetime($1)' LANGUAGE 'SQL';
::
:: CREATE FUNCTION reltime_timespan(int4)
:: RETURNS timespan
:: AS '/' LANGUAGE 'internal';
::
:: CREATE FUNCTION timespan(int4)
:: RETURNS timespan
:: AS 'select reltime_timespan($1)' LANGUAGE 'SQL';
::
::
:: 라는 function에 대해 잘 모르겠습니다.
:: 막상 function를 만들려고 하면 에러가 납니다.
::
::
:: psql:/usr/local/postgresql/7.0.2/contrib/unixdate/unixdate.sql:21: ERROR:
:: Only users with Postgres superuser privilege are permitted to create a
:: function in the 'internal' language. Others may use the 'sql' language or
:: the created procedural languages.
:: psql:/usr/local/postgresql/7.0.2/contrib/unixdate/unixdate.sql:25: ERROR:
:: Function 'abstime_datetime(int4)' does not exist
:: Unable to identify a function that satisfies the given argument types
:: You may need to add explicit typecasts
:: psql:/usr/local/postgresql/7.0.2/contrib/unixdate/unixdate.sql:29: ERROR:
:: Only users with Postg
:: res superuser privilege are permitted to create a function in
:: the 'internal' language. Others may use the 'sql' language or the created
:: procedural languages.
:: psql:/usr/local/postgresql/7.0.2/contrib/unixdate/unixdate.sql:33: ERROR:
:: Function 'reltime_tim
:: espan(int4)' does not exist
:: Unable to identify a function that satisfies the given argument types
:: You may need to add explicit typecasts
::
::
:: 그리고 function을 만들고 나서 어떻게 사용하는 건지도 잘모르겠습니다.
:: 조언 부탁드립니다.
::
|