Releasing PostgreSQL Extension on PGXN

  • 530 views
Uploaded on

So you've solved a common problem in PostgreSQL, a serious pain point that lots of other people could take advantage of. You want to open-source the code, and would like to package it up and …

So you've solved a common problem in PostgreSQL, a serious pain point that lots of other people could take advantage of. You want to open-source the code, and would like to package it up and distribute it where people can find it, read its docs, and download and install it.

The newest destination for distributing PostgreSQL extensions is <a>PGXN</a>, the PostgreSQL Extension network. PGXN offers a central index of PostgreSQL extensions and their documentation, making it easy for people to find an install extensions.

How do you optimize your extension distribution for maximum PGXN exposure? By careful packaging, thorough documentation, and simple installation. Join me for an overview of how best to achieve that — including how to build extensions compatible with PostgreSQL 9.1's improved extension support.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
530
On Slideshare
0
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
6
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide
  • TODO:\n&amp;#x2022; Add more privilege stuff?\n&amp;#x2022; Add example of renaming `flips.timestamp`?\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • TODO:\n&amp;#x2022; Add more privilege stuff?\n&amp;#x2022; Add example of renaming `flips.timestamp`?\n

Transcript

  • 1. Releasing Extensions on PGXN David E. Wheeler PostgreSQL Experts, Inc. PDXPUG April 21, 2019Text: Attribution-Noncommercial-Share Alike 3.0 United States:http://creativecommons.org/licenses/by-nc-sa/3.0/us/Images licensed independently and © Their respective owners.
  • 2. Problem Solved
  • 3. Problem SolvedSolved a database problem
  • 4. Problem SolvedSolved a database problemWant to share
  • 5. Problem SolvedSolved a database problemWant to shareOpen source it
  • 6. Problem SolvedSolved a database problemWant to shareOpen source itWhere to distribute
  • 7. PGXN
  • 8. PGXN“The PostgreSQL Extension network, is a central distribution system for open-source PostgreSQL extension libraries.”
  • 9. wheeler
  • 10. wheeler
  • 11. Your Solution
  • 12. Your SolutionYou’ve solved a problem
  • 13. Your SolutionYou’ve solved a problemUsing database objects
  • 14. Your SolutionYou’ve solved a problemUsing database objectsPackaged like contrib
  • 15. Your SolutionYou’ve solved a problemUsing database objectsPackaged like contribWant to open-source it
  • 16. Your SolutionYou’ve solved a problemUsing database objectsPackaged like contribWant to open-source itHow to distribute on PGXN?
  • 17. Your SolutionYou’ve solved a problemUsing database objectsPackaged like contribWant to open-source itHow to distribute on PGXN?Just one thing:
  • 18. Your SolutionYou’ve solved a problemUsing database objectsPackaged like contribWant to open-source itHow to distribute on PGXN?Just one thing:META.json
  • 19. META.jsonMETA.json
  • 20. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 21. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 22. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 23. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 24. META.json{ semver.org


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 25. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 26. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} META.json
  • 27. META.json{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}} At least this… META.json
  • 28. Package it Up!%

  • 29. Package it Up!%


git
archive
‐‐format
zip
‐‐prefix=pair‐0.1.0/


‐‐output
~/Desktop/pair‐0.1.0.zip
master%
  • 30. Package it Up!%


git
archive
‐‐format
zip
‐‐prefix=pair‐0.1.0/


‐‐output
~/Desktop/pair‐0.1.0.zip
master% Easy, eh?
  • 31. Tom Lanetgl@postgresql.orghttp://postgresql.org/~tgl/tomlane@tomlaneI’ve got some killer extensions in development that I thinkwill be useful to everyone, including:* pair: an ordered pair data type* PL/Brainfuck: just what it sounds like
  • 32. Tom Lanetgl@postgresql.orghttp://postgresql.org/~tgl/tomlane@tomlaneI’ve got some killer extensions in development that I thinkwill be useful to everyone, including:* pair: an ordered pair data type* PL/Brainfuck: just what it sounds like
  • 33. tomlane
  • 34. omg WTF ROTFL lolzomg WTF ROTFL lolz
  • 35. omg WTF ROTFL lolzomg WTF ROTFL lolz
  • 36. tomlane●●●●●●●●●●●●●●●●●●
  • 37. tomlane
  • 38. No resources,tags, or long description
  • 39. No documentation link
  • 40. Plain textREADME
  • 41. Add README Extension%

  • 42. Add README Extension%


git
mv
README.pair
README.md%
  • 43. Add README Extension%


git
mv
README.pair
README.md% Easy, eh?
  • 44. PGXN Markup
  • 45. PGXN MarkupHTML TextileMarkdown TracMultiMarkdown MediaWikiPod
  • 46. PGXN MarkupHTML TextileMarkdown TracMultiMarkdown MediaWikiPodText::Markup (fork me!)
  • 47. PGXN MarkupHTML TextileMarkdown TracMultiMarkdown MediaWikiPodText::Markup (fork me!)Write some Docs!
  • 48. Add Documentation
  • 49. Add DocumentationUse any supported markup
  • 50. Add DocumentationUse any supported markupPut wherever you like
  • 51. Add DocumentationUse any supported markupPut wherever you likeRecommend the doc/
  • 52. doc/pair.md
  • 53. pair
0.1.1==========Synopsis‐‐‐‐‐‐‐‐



%
CREATE
EXTENSION
pair;



CREATE
EXTENSION



%
SELECT
foo
~>
bar;







pair







‐‐‐‐‐‐‐‐‐‐‐‐




(foo,bar)Description‐‐‐‐‐‐‐‐‐‐‐This
library
contains
a
single
PostgreSQL
extension,
a
key/value
pair
data
type
called
“pair”,
along
with
a
convenience
function
for
constructing
key/value
pairs.
Its
just
a
simple
thing,
really:
a
two‐value
composite
type
that
can
store
any
type
of
value
in
its
slots,
which
are
named
`k`
and
`v`. doc/pair.md
  • 54. pair
0.1.1==========Synopsis‐‐‐‐‐‐‐‐ Must be UTF-8 or use a



%
CREATE
EXTENSION
pair;



CREATE
EXTENSION BOM



%
SELECT
foo
~>
bar;







pair







‐‐‐‐‐‐‐‐‐‐‐‐




(foo,bar)Description‐‐‐‐‐‐‐‐‐‐‐This
library
contains
a
single
PostgreSQL
extension,
a
key/value
pair
data
type
called
“pair”,
along
with
a
convenience
function
for
constructing
key/value
pairs.
Its
just
a
simple
thing,
really:
a
two‐value
composite
type
that
can
store
any
type
of
value
in
its
slots,
which
are
named
`k`
and
`v`. doc/pair.md
  • 55. Add Description{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}}META.json
  • 56. Add Description{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.0",


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"description":
"This
library
contains
a
key/value
pair
data
type
called
“pair”,
along
with
an
operator
for
constructing
key/value
pairs.",


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}}META.json
  • 57. Add Tags


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}}META.json
  • 58. Add Tags


"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"



,


}


"tags":
[





"ordered
pair",





"pair",





"key
value"


]}META.json
  • 59. Add Resources


"tags":
[





"ordered
pair",





"pair",





"key
value"


]}META.json
  • 60. Add Resources


"tags":
[





"ordered
pair",





"pair",





"key
value"



,


]


"resources":
{





"bugtracker":
{








"web":
"https://github.com/tgl/kv‐pair/issues/"





},





"repository":
{








"type":
"git",








"url":
"git://github.com/tgl/kv‐pair.git",








"web":
"https://github.com/tgl/kv‐pair/"





}


}}META.json
  • 61. What Extensions
  • 62. What ExtensionsMight have multiple extensions
  • 63. What ExtensionsMight have multiple extensionsExtension might have own version
  • 64. What ExtensionsMight have multiple extensionsExtension might have own versionMight have documentation file
  • 65. What ExtensionsMight have multiple extensionsExtension might have own versionMight have documentation fileHelp PGXN out!
  • 66. What ExtensionsMight have multiple extensionsExtension might have own versionMight have documentation fileHelp PGXN out!Add “provides” to META.json
  • 67. Add Provides





"repository":
{








"type":
"git",








"url":
"git://github.com/tgl/kv‐pair.git",








"web":
"https://github.com/tgl/kv‐pair/"





}


}}META.json
  • 68. Add Provides





"repository":
{








"type":
"git",








"url":
"git://github.com/tgl/kv‐pair.git",








"web":
"https://github.com/tgl/kv‐pair/"





}



,


}


"provides":
{





"pair":
{








"file":
"sql/pair.sql",








"version":
"0.1.0",








"abstract":
"A
key/value
pair
data
type",








"docfile":
"doc/pair.md"





}


}}META.json
  • 69. Add Provides





"repository":
{








"type":
"git",








"url":
"git://github.com/tgl/kv‐pair.git",








"web":
"https://github.com/tgl/kv‐pair/"





}



,


}


"provides":
{





"pair":
{








"file":
"sql/pair.sql", It’s unchanged!








"version":
"0.1.0",








"abstract":
"A
key/value
pair
data
type",








"docfile":
"doc/pair.md"





}


}}META.json
  • 70. Update Version{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.
", 0


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"description":
"This
library
contains
a
key/value
pair
data
type
called
“pair”,
along
with
an
operator
for
constructing
key/value
pairs.",

"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}}META.json
  • 71. Update Version{


"name":






"pair",


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.
", 1


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"description":
"This
library
contains
a
key/value
pair
data
type
called
“pair”,
along
with
an
operator
for
constructing
key/value
pairs.",

"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}}META.json
  • 72. Update Version{


"name":






"pair", Must be


"abstract":


"A
key/value
pair
data
type",


"version":



"0.1.
", 1 unique.


"maintainer":
"Tom
Lane
<tgl@postgresql.org>",


"license":



"postgresql",


"description":
"This
library
contains
a
key/value
pair
data
type
called
“pair”,
along
with
an
operator
for
constructing
key/value
pairs.",

"meta‐spec":

{





"version":
"1.0.0",





"url":
"http://pgxn.org/meta/spec.txt"


}}META.json
  • 73. Package it up%

  • 74. Package it up%


git
archive
‐‐format
zip
‐‐prefix=pair‐0.1.1/


‐‐output
~/Desktop/pair‐0.1.1.zip
master%
  • 75. Release it
  • 76. Lots of great metadata!
  • 77. Link todocumentation!
  • 78. README in HTML!
  • 79. README in HTML!
  • 80. Niiiice.
  • 81. What Else?
  • 82. What Else?Recommended file layout
  • 83. What Else?Recommended file layoutStandard Makefile format
  • 84. What Else?Recommended file layoutStandard Makefile format9.1 CREATE EXTENSION support
  • 85. What Else?Recommended file layoutStandard Makefile format9.1 CREATE EXTENSION support With compatibility!
  • 86. File Recommendations
  • 87. File RecommendationsSQL source in sql/
  • 88. File RecommendationsSQL source in sql/C source in src/
  • 89. File RecommendationsSQL source in sql/C source in src/Tests in test/
  • 90. File RecommendationsSQL source in sql/C source in src/Tests in test/Documentation in docs/
  • 91. Rearrange%

  • 92. Rearrange%
%
mkdir
test
  • 93. Rearrange%
%
mkdir
test%
git
mv
sql
test/
  • 94. Rearrange%
%
mkdir
test%
git
mv
sql
test/%
git
mv
expected
test/
  • 95. Rearrange%
%
mkdir
test%
git
mv
sql
test/%
git
mv
expected
test/%
mkdir
sql
  • 96. Rearrange%
%
mkdir
test%
git
mv
sql
test/%
git
mv
expected
test/%
mkdir
sql%
git
mv
*.sql
sql/
  • 97. MakefileMakefile
  • 98. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c)) Makefile
  • 99. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c)) Makefile
  • 100. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c)) Makefile
  • 101. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c)) Makefile
  • 102. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=test Makefile
  • 103. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=test Makefile
  • 104. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=test Makefile
  • 105. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=test Makefile
  • 106. Makefile inputdirDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=test Makefile
  • 107. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testPG_CONFIG
=
pg_configPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 108. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testPG_CONFIG
=
pg_configPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 109. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testPG_CONFIG
=
pg_configPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 110. MakefileDATA



=
$(wildcard
sql/*.sql)DOCS



=
$(wildcard
doc/*.txt)MODULES
=
$(patsubst
%.c,%,$(wildcard
src/*.c))TESTS
=
$(wildcard
test/sql/*.sql)REGRESS
=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testPG_CONFIG
=
pg_configPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 111. CREATE EXTENSION
  • 112. CREATE EXTENSIONNew in 9.1
  • 113. CREATE EXTENSIONNew in 9.1Add extension to a DB with
  • 114. CREATE EXTENSIONNew in 9.1Add extension to a DB with CREATE EXTENSION pair;
  • 115. CREATE EXTENSIONNew in 9.1Add extension to a DB with CREATE EXTENSION pair;No need to run SQL script in psql
  • 116. Packaging Extensions Needs
  • 117. Packaging Extensions NeedsControl file
  • 118. Packaging Extensions NeedsControl fileMigration from unpackaged
  • 119. Packaging Extensions NeedsControl fileMigration from unpackaged pair--unpackaged--0.1.0.sql
  • 120. Packaging Extensions NeedsControl fileMigration from unpackaged pair--unpackaged--0.1.0.sqlProperly-named SQL script
  • 121. Packaging Extensions NeedsControl fileMigration from unpackaged pair--unpackaged--0.1.0.sqlProperly-named SQL script pair--0.1.0.sql
  • 122. Create the control filepair.control
  • 123. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 124. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 125. Create the control file Optional#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 126. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 127. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 128. Create the control file#
pair
extension For Ccomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0 codemodule_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 129. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 130. Create the control file#
pair
extension Can movecomment
=
A
key/value
pair
data
type schemasdefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 131. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control
  • 132. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
true Not requiredsuperuser
=
false to install pair.control
  • 133. Create the control file#
pair
extensioncomment
=
A
key/value
pair
data
typedefault_version
=
0.1.0module_pathname
=
$libdir/pairrelocatable
=
truesuperuser
=
false pair.control pair.control
  • 134. Migration from Unpackagedsql/pair‐‐unpac…
  • 135. Migration from UnpackagedALTER
EXTENSION
pair
ADD
TYPE
pair;ALTER
EXTENSION
pair
ADD
FUNCTION
pair(anyelement,
text);ALTER
EXTENSION
pair
ADD
FUNCTION
pair(text,
anyelement);ALTER
EXTENSION
pair
ADD
FUNCTION
pair(anyelement,
anyelement);ALTER
EXTENSION
pair
ADD
FUNCTION
pair(text,
text);ALTER
EXTENSION
pair
ADD
OPERATOR
~>(text,
anyelement);ALTER
EXTENSION
pair
ADD
OPERATOR
~>(anyelement,
text);ALTER
EXTENSION
pair
ADD
OPERATOR
~>(anyelement,
anyelement);ALTER
EXTENSION
pair
ADD
OPERATOR
~>(text,
text); sql/pair--unpackaged--0.1.0.sql sql/pair‐‐unpac…
  • 136. Update the MakefileMakefile
  • 137. Update the MakefileEXTENSION



=
semverEXTVERSION


=
$(shell
grep
default_version


$(EXTENSION).control
|

sed
‐e


"s/default_version[
]*=[
]*([^]*)/1/")DATA








=
$(filter‐out
$(wildcard
sql/*‐‐*.sql),$(wildcard
sql/*.sql))DOCS








=
$(wildcard
doc/*.txt)TESTS







=
$(wildcard
test/sql/*.sql)REGRESS





=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testMODULES





=
$(patsubst
%.c,%,$(wildcard
src/*.c))PG_CONFIG



=
pg_configPG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 138. Update the MakefileEXTENSION



=
semverEXTVERSION


=
$(shell
grep
default_version


$(EXTENSION).control
|

sed
‐e


"s/default_version[
]*=[
]*([^]*)/1/")DATA








=
$(filter‐out
$(wildcard
sql/*‐‐*.sql),$(wildcard
sql/*.sql))DOCS








=
$(wildcard
doc/*.txt)TESTS







=
$(wildcard
test/sql/*.sql)REGRESS





=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testMODULES





=
$(patsubst
%.c,%,$(wildcard
src/*.c))PG_CONFIG



=
pg_configPG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 139. Update the MakefileEXTENSION



=
semverEXTVERSION


=
$(shell
grep
default_version


$(EXTENSION).control
|

sed
‐e


"s/default_version[
]*=[
]*([^]*)/1/")DATA








=
$(filter‐out
$(wildcard
sql/*‐‐*.sql),$(wildcard
sql/*.sql))DOCS








=
$(wildcard
doc/*.txt)TESTS







=
$(wildcard
test/sql/*.sql)REGRESS





=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testMODULES





=
$(patsubst
%.c,%,$(wildcard
src/*.c))PG_CONFIG



=
pg_configPG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 140. Update the Makefile Extract fromEXTENSION



=
semverEXTVERSION


=
$(shell
grep
default_version
 control file

$(EXTENSION).control
|

sed
‐e


"s/default_version[
]*=[
]*([^]*)/1/")DATA








=
$(filter‐out
$(wildcard
sql/*‐‐*.sql),$(wildcard
sql/*.sql))DOCS








=
$(wildcard
doc/*.txt)TESTS







=
$(wildcard
test/sql/*.sql)REGRESS





=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testMODULES





=
$(patsubst
%.c,%,$(wildcard
src/*.c))PG_CONFIG



=
pg_configPG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 141. Update the MakefileEXTENSION



=
semverEXTVERSION


=
$(shell
grep
default_version


$(EXTENSION).control
|

sed
‐e


"s/default_version[
]*=[
]*([^]*)/1/")DATA








=
$(filter‐out
$(wildcard
sql/*‐‐*.sql),$(wildcard
sql/*.sql))DOCS








=
$(wildcard
doc/*.txt)TESTS







=
$(wildcard
test/sql/*.sql)REGRESS





=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testMODULES





=
$(patsubst
%.c,%,$(wildcard
src/*.c))PG_CONFIG



=
pg_configPG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 142. Update the MakefileEXTENSION



=
semverEXTVERSION


=
$(shell
grep
default_version


$(EXTENSION).control
|

sed
‐e


"s/default_version[
]*=[
]*([^]*)/1/")DATA








=
$(filter‐out
$(wildcard
sql/*‐‐*.sql),$(wildcard
sql/*.sql))DOCS








=
$(wildcard
doc/*.txt)TESTS







=
$(wildcard
test/sql/*.sql)REGRESS





=
$(patsubst
test/sql/%.sql,%,$(TESTS))REGRESS_OPTS
=
‐‐inputdir=testMODULES





=
$(patsubst
%.c,%,$(wildcard
src/*.c))PG_CONFIG



=
pg_configPG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 143. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes) Makefile
  • 144. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 145. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 146. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 147. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 148. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 149. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 150. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 151. Update the MakefilePG91

=
$(shell
$(PG_CONFIG)
‐‐version


|
grep
‐qE
"
8.|
9.0"
&&
echo
no
||
echo
yes)ifeq
($(PG91),yes)all:
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlsql/$(EXTENSION)‐‐$(EXTVERSION).sql:
sql/$(EXTENSION).sql
 cp
$<
$@DATA
=
$(wildcard
sql/*‐‐*.sql)
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlEXTRA_CLEAN
=
sql/$(EXTENSION)‐‐$(EXTVERSION).sqlendifPGXS
:=
$(shell
$(PG_CONFIG)
‐‐pgxs)include
$(PGXS) Makefile
  • 152. Or Forget It
  • 153. Or Forget ItCopy Makefile
  • 154. Or Forget ItCopy MakefileEdit first line
  • 155. Or Forget ItCopy MakefileEdit first line EXTENSION=pair
  • 156. Or Forget ItCopy MakefileEdit first line EXTENSION=pairIgnore the rest
  • 157. %
curl
‐O
http://api.pgxn.org/dist/pair/0.1.2/pair‐0.1.2.pgz%
unzip
pair‐0.1.2.pgz
Archive:

pair‐0.1.2.pgz%
cd
pair‐0.1.2%
  • 158. %
curl
‐O
http://api.pgxn.org/dist/pair/0.1.2/pair‐0.1.2.pgz%
unzip
pair‐0.1.2.pgz
Archive:

pair‐0.1.2.pgz%
cd
pair‐0.1.2
%
makecp
sql/pair.sql
sql/pair‐‐0.1.2.sqlcp
sql/pair‐‐unpackaged.sql
sql/pair‐‐unpackaged‐‐0.1.2.sql%
sudo
make
install#
…elided%
  • 159. %
curl
‐O
http://api.pgxn.org/dist/pair/0.1.2/pair‐0.1.2.pgz%
unzip
pair‐0.1.2.pgz
Archive:

pair‐0.1.2.pgz%
cd
pair‐0.1.2
%
makecp
sql/pair.sql
sql/pair‐‐0.1.2.sqlcp
sql/pair‐‐unpackaged.sql
sql/pair‐‐unpackaged‐‐0.1.2.sql%
sudo
make
install#
…elided
%
psql
trypsql
(9.1devel)Type
"help"
for
help.try=#
create
extension
pair;CREATE
EXTENSIONtry=#

  • 160. %
curl
‐O
http://api.pgxn.org/dist/pair/0.1.2/pair‐0.1.2.pgz%
unzip
pair‐0.1.2.pgz
Archive:

pair‐0.1.2.pgz%
cd
pair‐0.1.2
%
makecp
sql/pair.sql
sql/pair‐‐0.1.2.sqlcp
sql/pair‐‐unpackaged.sql
sql/pair‐‐unpackaged‐‐0.1.2.sql%
sudo
make
install#
…elided
%
psql
trypsql
(9.1devel)Type
"help"
for
help.try=#
create
extension
pair;CREATE
EXTENSION





dTtry=#





List
of
data
types
Schema
|
Name
|
Description
‐‐‐‐‐‐‐‐+‐‐‐‐‐‐+‐‐‐‐‐‐‐‐‐‐‐‐‐
public
|
pair
|
(1
row)try=#

  • 161. %
curl
‐O
http://api.pgxn.org/dist/pair/0.1.2/pair‐0.1.2.pgz%
unzip
pair‐0.1.2.pgz
Archive:

pair‐0.1.2.pgz%
cd
pair‐0.1.2
%
makecp
sql/pair.sql
sql/pair‐‐0.1.2.sqlcp
sql/pair‐‐unpackaged.sql
sql/pair‐‐unpackaged‐‐0.1.2.sql%
sudo
make
install#
…elided
%
psql
trypsql
(9.1devel)Type
"help"
for
help.try=#
create
extension
pair;CREATE
EXTENSION





dTtry=#





List
of
data
types
Schema
|
Name
|
Description
‐‐‐‐‐‐‐‐+‐‐‐‐‐‐+‐‐‐‐‐‐‐‐‐‐‐‐‐
public
|
pair
|
(1
row)try=#
 Wow!
  • 162. Thank you. Releasing Extensions on PGXN David E. Wheeler PostgreSQL Experts, Inc.Text: Attribution-Noncommercial-Share Alike 3.0 United States:http://creativecommons.org/licenses/by-nc-sa/3.0/us/Images licensed independently and © Their respective owners.