Jump to content
php.lv forumi

postgresql nestrādā "CREATE LANGUAGE"


Zandis Murāns

Recommended Posts

Kas par jokiem? Tipa uz viena postgresql servera palaidu "CREATE LANGUAGE plpgsql;" un viss notikās, viss strādā, a uz cita:

ERROR:  syntax error at or near ";"
LINE 1: CREATE LANGUAGE plpgsql;
						   ^

********** Error **********

ERROR: syntax error at or near ";"
SQL state: 42601
Character: 24

Link to comment
Share on other sites

Publiski?

 

"PostgreSQL 8.2.6 on i486-pc-linux-gnu, compiled by GCC cc (GCC) 4.1.3 20070929 (prerelease) (Ubuntu 4.1.2-16ubuntu2)" - tur iet,

"PostgreSQL 8.0.9 on i386-pc-dragonfly, compiled by GCC gcc (GCC) 3.4.5 20050809 (prerelease) [DragonFly] (propolice, visibility)" - a tur nē.

Link to comment
Share on other sites

Nezinu gan kāpēc tu gribētu taisīt jaunu valodu, bet no tā linka toč ir skaidrs, ka jābūt ir uzdefinētai kautkādai handlera funkcijai, kura mācēs izpildīt tavas jaunās valodas funkcijas.

Ja tev nav pieejama šī handlera funkcija kautkādā gatavā bibliotēkā, tad fig tev sanāks uztaisīt to valodu.

 

Tipa no šī linka http://www.postgresql.org/docs/8.2/static/...telanguage.html man top skaidrs, ka

"There are two forms of the CREATE LANGUAGE command. In the first form, the user supplies just the name of the desired language, and the PostgreSQL server consults the pg_pltemplate system catalog to determine the correct parameters. "

Tb Postgre kautkādām savām esošām valodām māk paņemt to handleri no pg_pltemplate sistēmas kataloga. Vecākās versijās acīmredzot nebija šāda pg_pltemplate, un vajadzēja vienmēr to handleri norādīt manuāli.

 

Vecākām versijām btw manuālī ir rakstīts: "This command normally should not be executed directly by users. For the procedural languages supplied in the PostgreSQL distribution, the createlang program should be used, which will also install the correct call handler. (createlang will call CREATE LANGUAGE internally.)"

 

Tā ka RTFM vairāk :)

Link to comment
Share on other sites

--Izveidoju valodas handleri

CREATE OR REPLACE FUNCTION plpgsql_call_handler()
 RETURNS language_handler AS '$libdir/plpgsql', 'plpgsql_call_handler'
 LANGUAGE 'c' VOLATILE;
ALTER FUNCTION plpgsql_call_handler() OWNER TO pgsql;

--Izveidoju valodu:
CREATE LANGUAGE plpgsql handler plpgsql_call_handler;

Edited by Zandis Murāns
Link to comment
Share on other sites

×
×
  • Create New...