Database Reference
In-Depth Information
Writing your extension code
Put your SQL code in the file that was provided for you in myextension/sql/my-
extension.sql . This file should contain all of the objects that make up your exten-
sion.
/* myextension.sql */
-- complain if script is sourced in psql,
rather than via CREATE EXTENSION
\echo Use "CREATE EXTENSION myextension" to
load this file. \quit
CREATE FUNCTION feed_the_hungry() ...
You can provide any additional SQL files in the same directory for maintaining ver-
sions as described in the Extension versions section. Anything named *.sql that is
located in this directory will be included in the distribution.
Creating the package
To ultimately submit our extension to the PostgreSQL Extension Network, we need
to package all the files into a single zip file. Assuming we're following good practices,
and we're keeping all of our source code in a handy Git repository, we can create the
package through a simple git command. Try this one on for size:
git archive --format zip
--prefix=myextension-0.0.1/ \
--output ~/Desktop/myextension-0.0.1.zip
master
This command will create a package for you that is suitable for submission to the
PostgreSQL Extension Network. All we need to do now is submit it.
Search WWH ::




Custom Search