]> Untitled Git - articles.git/commitdiff
Creating extension, slides for nepal talks in October
authorNikolay Shaplov <dhyan@nataraj.su>
Fri, 17 Oct 2025 07:38:40 +0000 (10:38 +0300)
committerNikolay Shaplov <dhyan@nataraj.su>
Fri, 17 Oct 2025 07:38:40 +0000 (10:38 +0300)
33 files changed:
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-10 - Creating own extension, Nepal/Creating_extension_2025.odp [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/README.md [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/log.log [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/Makefile [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/expected/my_first_extension-main-test.out [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.1--0.0.2.sql [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.2--0.0.3.sql [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.3.sql [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension.c [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension.control [new file with mode: 0644]
slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/sql/my_first_extension-main-test.sql [new file with mode: 0644]
slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp [deleted file]
slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf [deleted file]
slides/2025 - Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp [deleted file]
slides/2025 - Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf [deleted file]
slides/2025 - Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp [deleted file]
slides/2025 - Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf [deleted file]
slides/2025 - Creating own extension/README.md [deleted file]
slides/2025 - Creating own extension/code/log.log [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/Makefile [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/expected/my_first_extension-main-test.out [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.1--0.0.2.sql [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.2--0.0.3.sql [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.3.sql [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/my_first_extension.c [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/my_first_extension.control [deleted file]
slides/2025 - Creating own extension/code/my_first_extension/sql/my_first_extension-main-test.sql [deleted file]

diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp
new file mode 100644 (file)
index 0000000..c7faadb
Binary files /dev/null and b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf
new file mode 100644 (file)
index 0000000..e5a329d
Binary files /dev/null and b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp
new file mode 100644 (file)
index 0000000..6c04d17
Binary files /dev/null and "b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\230\320\242\320\234\320\236, \320\222\320\250\320\255/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.odp" differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf
new file mode 100644 (file)
index 0000000..6ee00ce
Binary files /dev/null and "b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\230\320\242\320\234\320\236, \320\222\320\250\320\255/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.pdf" differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp
new file mode 100644 (file)
index 0000000..58133f2
Binary files /dev/null and "b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\255\320\273\320\270\321\201\321\202\320\260/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.odp" differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf
new file mode 100644 (file)
index 0000000..07f2634
Binary files /dev/null and "b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-08 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\255\320\273\320\270\321\201\321\202\320\260/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.pdf" differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-10 - Creating own extension, Nepal/Creating_extension_2025.odp b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-10 - Creating own extension, Nepal/Creating_extension_2025.odp
new file mode 100644 (file)
index 0000000..30037e5
Binary files /dev/null and b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/2025-10 - Creating own extension, Nepal/Creating_extension_2025.odp differ
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/README.md b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/README.md
new file mode 100644 (file)
index 0000000..ca496a5
--- /dev/null
@@ -0,0 +1,10 @@
+### Аннотация
+
+#### Создание расширения PostgreSQL
+#### Первый шаг на пути к разработке ядра postgres.
+
+Популярность PostgreSQL обеспечивается не только ее производительностью и доступностью, но во многом своим открытым процессом разработки: исходный код СУБД доступен для изучения и модификации, и любой желающий может принять участие в разработке ядра проекта, предлагая свое улучшения и изменения.
+Программист для того чтобы стать ядра разработчиком ядра PostgreSQL должен пройти длинный путь, но практически каждый начинает свое движение с разработки расширения PostgreSQL.
+PostgreSQL предоставляет широкие возможности по расширению функциональности и модификации поведения ядра СУБД через механизм расширений.
+
+В этой лекции мы рассмотрим основы создания расширений: что это такое, из каких элементов оно состоит, и создадим первое учебное расширение.
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/log.log b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/log.log
new file mode 100644 (file)
index 0000000..5832a3c
--- /dev/null
@@ -0,0 +1,361 @@
+Extension is a set of PostgreSQL objects that can be `CREATE`ed.
+Like `CREATE FUNCTION`, `CREATE TYPE` or `CREATE OPERATOR`.
+This set is created, updated and deleted as a bundle.
+When you do `CREATE EXTENSION` you it will create all object included into extension.
+When you do `DROP EXTENSION` all that objects will be automatically removed.
+
+So extension is just a set of SQL commands to create or update extension schema.
+(You even do not need to delete it, `DROP EXTENSION` will delete them automatically)
+
+Functions may be written in `PL/pgSQL` or other `PL/*` or you can load binary function from shared `.so` library.
+.
+You can register a function as a hook handler to change behavior if PostgreSQL.
+
+
+
+See https://github.com/IshaanAdarsh/Postgres-extension-tutorial/blob/main/SGML/Main.md for more info
+
+```
+
+$ whoami
+nataraj
+
+$ sudo -u postgres createuser -s nataraj
+```
+
+Make sure that `-dev` files for postgres are installed. In Debian-based distributives it wil
+be like this
+
+```
+sudo apt-get install postgresql-server-dev-all
+
+```
+
+
+```
+$ mkdir my_first_extension
+
+$ cd my_first_extension
+```
+
+```
+touch my_first_extension.control
+```
+
+```
+# my_first_extension.control
+# Comment line to provide additional information about the extension
+comment = 'My Very First Extension'
+
+# Specifies the default version of the extension
+default_version = '0.0.1'
+```
+
+https://www.postgresql.org/docs/17/extend-extensions.html#EXTEND-EXTENSIONS-FILES
+
+
+---
+
+```
+touch my_first_extension--0.0.1.sql
+```
+
+```
+CREATE TABLE my_first_extension_table (
+  id SERIAL PRIMARY KEY,
+  my_string VARCHAR NOT NULL
+);
+
+INSERT INTO my_first_extension_table (my_string) VALUES('Hello, World');
+```
+
+---
+
+```
+touch Makefile
+```
+
+```
+EXTENSION = my_first_extension           # Name of the extension
+DATA = my_first_extension--0.0.1.sql     # SQL file containing extension objects and functions
+
+PG_CONFIG  ?= pg_config                  # Path to the pg_config executable
+PGXS := $(shell $(PG_CONFIG) --pgxs)     # Get the PostgreSQL Extension Makefile from pg_config
+include $(PGXS)                          # Include the PostgreSQL Extension Makefile
+```
+
+---
+
+```
+make
+sudo make install
+```
+
+```
+sudo -u postgres psql
+
+# CREATE EXTENSION my_first_extension;
+CREATE EXTENSION
+
+# SELECT * FROM my_first_extension_table;
+ id |  my_string   
+----+--------------
+  1 | Hello, World
+(1 row)
+
+# DROP EXTENSION my_first_extension;
+DROP EXTENSION
+
+# SELECT * FROM my_first_extension_table;
+ERROR:  relation "my_first_extension_table" does not exist
+СТРОКА 1: SELECT * FROM my_first_extension_table;
+                        ^
+```
+
+------------
+
+# Add tests
+
+```
+mkdir sql
+```
+
+edit `sql/my_first_extension-main-test.sql`
+
+```
+CREATE EXTENSION my_first_extension;
+
+SELECT * FROM my_first_extension_table;
+
+DROP EXTENSION
+
+-- There should be no my_first_extension_table anymore
+SELECT * FROM my_first_extension_table;
+```
+
+----
+
+change Makefile
+
+```
+EXTENSION = my_first_extension           # Name of the extension
+DATA = my_first_extension--0.0.1.sql     # SQL file containing extension objects and functions
+REGRESS = my_first_extension-main-test
+
+
+PG_CONFIG  ?= pg_config                  # Path to the pg_config executable
+PGXS := $(shell $(PG_CONFIG) --pgxs)     # Get the PostgreSQL Extension Makefile from pg_config
+include $(PGXS)                          # Include the PostgreSQL Extension Makefile
+```
+
+run `make installcheck`
+
+
+and get an error: `my_first_extension/expected/my_first_extension-main-test.out: No such file or directory`
+
+and a `results` dir.
+
+----
+
+Check that `results/my_first_extension-main-test.out` is what you expect
+
+```
+$ cat results/my_first_extension-main-test.out 
+CREATE EXTENSION my_first_extension;
+SELECT * FROM my_first_extension_table;
+ id |  my_string   
+----+--------------
+  1 | Hello, World
+(1 row)
+
+DROP EXTENSION
+-- There should be no my_first_extension_table anymore
+SELECT * FROM my_first_extension_table;
+ERROR:  syntax error at or near "SELECT"
+LINE 3: SELECT * FROM my_first_extension_table;
+        ^
+```
+
+----
+
+If everything as you expected copy `my_first_extension-main-test.out` from `results` dir to `expected` 
+```
+mkdir expected
+cp results/my_first_extension-main-test.out expected
+```
+
+----
+
+Now tests should pass
+
+```
+n$ make installcheck
+echo "+++ regress install-check in  +++" && /usr/lib/postgresql/15/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/15/bin'    --dbname=contrib_regression my_first_extension-main-test
++++ regress install-check in  +++
+(using postmaster on Unix socket, default port)
+============== dropping database "contrib_regression" ==============
+SET
+DROP DATABASE
+============== creating database "contrib_regression" ==============
+CREATE DATABASE
+ALTER DATABASE
+ALTER DATABASE
+ALTER DATABASE
+ALTER DATABASE
+ALTER DATABASE
+ALTER DATABASE
+============== running regression test queries        ==============
+test my_first_extension-main-test ... ok           54 ms
+
+=====================
+ All 1 tests passed. 
+=====================
+```
+
+-----
+
+Now let's create create a new version of extension, with a plpsql function in it
+
+* Change version from `0.0.1` to `0.0.2` in `my_first_extension.control`:
+
+```
+default_version = '0.0.2'
+```
+
+* rename schema creation file from `my_first_extension--0.0.1.sql` to `my_first_extension--0.0.2.sql`
+* create an schema update file `my_first_extension--0.0.1--0.0.2.sql`
+
+Add to both of them function creation code
+
+```
+CREATE FUNCTION my_one()
+returns int
+language plpgsql
+as
+$$
+begin
+   return 1;
+end;
+$$;
+
+```
+
+* Update `Makefile` adding new sql file names to `DATA` variable
+
+```
+DATA = my_first_extension--0.0.2.sql my_first_extension--0.0.1--0.0.2.sql
+```
+
+* install extension
+
+```
+sudo make install
+
+```
+
+* check everything works
+
+```
+$ sudo -u postgres psql
+
+=# CREATE EXTENSION my_first_extension;
+CREATE EXTENSION
+
+s=# SELECT my_one();
+ my_one 
+--------
+      1
+(1 row)
+```
+
+----
+
+Write test for `my_one` function yourself
+
+----
+
+https://www.highgo.ca/2020/01/10/how-to-create-test-and-debug-an-extension-written-in-c-for-postgresql/
+
+
+Creating C-function
+
+// Do not forget to install `postgresql-server-dev-all`
+
+create `my_first_extension.c` file
+
+```
+#include "postgres.h"
+#include "fmgr.h"
+
+PG_MODULE_MAGIC;
+
+PG_FUNCTION_INFO_V1(my_get_two);
+
+Datum
+my_get_two(PG_FUNCTION_ARGS)
+{
+    PG_RETURN_INT32(2);
+}
+```
+
+add following lines to `Makefile`
+
+```
+MODULE_big  = my_first_extension
+OBJS = my_first_extension.o
+
+```
+and to the `my_first_extension.control`
+
+
+```
+module_pathname = '$libdir/my_first_extension'
+
+```
+
+
+Check everything works well by running
+
+```
+make
+```
+
+add to schema
+```
+CREATE FUNCTION my_two()
+RETURNS INT
+AS 'MODULE_PATHNAME', 'my_get_two'
+LANGUAGE C;
+```
+
+
+bump version in *.sql files, Makefile and control file
+
+
+```
+make
+sudo make install
+```
+
+Check everything works:
+
+```
+$ sudo -u postgres psql
+
+=# DROP EXTENSION my_first_extension;
+DROP EXTENSION
+
+=# CREATE EXTENSION my_first_extension;
+CREATE EXTENSION
+postgres=# SELECT my_two();
+ my_two 
+--------
+      2
+(1 row)
+
+```
+
+Do not forget to write tests! 
+
+
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/Makefile b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/Makefile
new file mode 100644 (file)
index 0000000..4b14455
--- /dev/null
@@ -0,0 +1,13 @@
+MODULE_big     = my_first_extension
+EXTENSION = my_first_extension           # Name of the extension
+DATA = my_first_extension--0.0.3.sql my_first_extension--0.0.1--0.0.2.sql my_first_extension--0.0.2--0.0.3.sql
+REGRESS = my_first_extension-main-test
+
+OBJS = my_first_extension.o
+
+
+PG_CONFIG  ?= pg_config                  # Path to the pg_config executable
+PGXS := $(shell $(PG_CONFIG) --pgxs)     # Get the PostgreSQL Extension Makefile from pg_config
+include $(PGXS)                          # Include the PostgreSQL Extension Makefile
+
+
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/expected/my_first_extension-main-test.out b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/expected/my_first_extension-main-test.out
new file mode 100644 (file)
index 0000000..a0b8cc9
--- /dev/null
@@ -0,0 +1,13 @@
+CREATE EXTENSION my_first_extension;
+SELECT * FROM my_first_extension_table;
+ id |  my_string   
+----+--------------
+  1 | Hello, World
+(1 row)
+
+DROP EXTENSION my_first_extension;
+-- There should be no my_first_extension_table anymore
+SELECT * FROM my_first_extension_table;
+ERROR:  relation "my_first_extension_table" does not exist
+LINE 1: SELECT * FROM my_first_extension_table;
+                      ^
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.1--0.0.2.sql b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.1--0.0.2.sql
new file mode 100644 (file)
index 0000000..9c107ac
--- /dev/null
@@ -0,0 +1,10 @@
+CREATE FUNCTION my_one()
+returns int
+language plpgsql
+as
+$$
+begin
+   return 1;
+end;
+$$;
+
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.2--0.0.3.sql b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.2--0.0.3.sql
new file mode 100644 (file)
index 0000000..7b9adcd
--- /dev/null
@@ -0,0 +1,5 @@
+CREATE FUNCTION my_two()
+RETURNS INT
+AS 'MODULE_PATHNAME', 'my_get_two'
+LANGUAGE C;
+
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.3.sql b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension--0.0.3.sql
new file mode 100644 (file)
index 0000000..b25f223
--- /dev/null
@@ -0,0 +1,24 @@
+CREATE TABLE my_first_extension_table (
+  id SERIAL PRIMARY KEY,
+  my_string VARCHAR NOT NULL
+);
+
+INSERT INTO my_first_extension_table (my_string) VALUES('Hello, World');
+
+
+CREATE FUNCTION my_one()
+returns int
+language plpgsql
+as
+$$
+begin
+   return 1;
+end;
+$$;
+
+
+CREATE FUNCTION my_two()
+RETURNS INT
+AS 'MODULE_PATHNAME', 'my_get_two'
+LANGUAGE C;
+
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension.c b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension.c
new file mode 100644 (file)
index 0000000..a126494
--- /dev/null
@@ -0,0 +1,12 @@
+#include "postgres.h"
+#include "fmgr.h"
+
+PG_MODULE_MAGIC;
+
+PG_FUNCTION_INFO_V1(my_get_two);
+
+Datum
+my_get_two(PG_FUNCTION_ARGS)
+{
+    PG_RETURN_INT32(2);
+}
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension.control b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/my_first_extension.control
new file mode 100644 (file)
index 0000000..68688a0
--- /dev/null
@@ -0,0 +1,8 @@
+# my_first_extension.control
+# Comment line to provide additional information about the extension
+comment = 'My Very First Extension'
+
+# Specifies the default version of the extension
+default_version = '0.0.3'
+module_pathname = '$libdir/my_first_extension'
+
diff --git a/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/sql/my_first_extension-main-test.sql b/slides/2025 - Becoming PosgtreSQL Developer. 1. Creating own extension/code/my_first_extension/sql/my_first_extension-main-test.sql
new file mode 100644 (file)
index 0000000..8992652
--- /dev/null
@@ -0,0 +1,9 @@
+CREATE EXTENSION my_first_extension;
+
+SELECT * FROM my_first_extension_table;
+
+DROP EXTENSION my_first_extension;
+
+-- There should be no my_first_extension_table anymore
+SELECT * FROM my_first_extension_table;
+
diff --git a/slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp b/slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp
deleted file mode 100644 (file)
index c7faadb..0000000
Binary files a/slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.odp and /dev/null differ
diff --git a/slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf b/slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf
deleted file mode 100644 (file)
index e5a329d..0000000
Binary files a/slides/2025 - Creating own extension/2025 - Creating own extension, Nepal/Creating_extension_2025.pdf and /dev/null differ
diff --git a/slides/2025 - Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp b/slides/2025 - Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp
deleted file mode 100644 (file)
index 6c04d17..0000000
Binary files "a/slides/2025 - Creating own extension/2025 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\230\320\242\320\234\320\236, \320\222\320\250\320\255/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.odp" and /dev/null differ
diff --git a/slides/2025 - Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf b/slides/2025 - Creating own extension/2025 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, Ð\98ТÐ\9cÐ\9e, Ð\92ШЭ/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf
deleted file mode 100644 (file)
index 6ee00ce..0000000
Binary files "a/slides/2025 - Creating own extension/2025 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\230\320\242\320\234\320\236, \320\222\320\250\320\255/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.pdf" and /dev/null differ
diff --git a/slides/2025 - Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp b/slides/2025 - Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.odp
deleted file mode 100644 (file)
index 58133f2..0000000
Binary files "a/slides/2025 - Creating own extension/2025-08 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\255\320\273\320\270\321\201\321\202\320\260/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.odp" and /dev/null differ
diff --git a/slides/2025 - Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf b/slides/2025 - Creating own extension/2025-08 - Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f, ЭлиÑ\81Ñ\82а/Создание Ñ\81обÑ\81Ñ\82венного Ñ\80аÑ\81Ñ\88иÑ\80ениÑ\8f-2025.pdf
deleted file mode 100644 (file)
index 07f2634..0000000
Binary files "a/slides/2025 - Creating own extension/2025-08 - \320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217, \320\255\320\273\320\270\321\201\321\202\320\260/\320\241\320\276\320\267\320\264\320\260\320\275\320\270\320\265 \321\201\320\276\320\261\321\201\321\202\320\262\320\265\320\275\320\275\320\276\320\263\320\276 \321\200\320\260\321\201\321\210\320\270\321\200\320\265\320\275\320\270\321\217-2025.pdf" and /dev/null differ
diff --git a/slides/2025 - Creating own extension/README.md b/slides/2025 - Creating own extension/README.md
deleted file mode 100644 (file)
index ca496a5..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-### Аннотация
-
-#### Создание расширения PostgreSQL
-#### Первый шаг на пути к разработке ядра postgres.
-
-Популярность PostgreSQL обеспечивается не только ее производительностью и доступностью, но во многом своим открытым процессом разработки: исходный код СУБД доступен для изучения и модификации, и любой желающий может принять участие в разработке ядра проекта, предлагая свое улучшения и изменения.
-Программист для того чтобы стать ядра разработчиком ядра PostgreSQL должен пройти длинный путь, но практически каждый начинает свое движение с разработки расширения PostgreSQL.
-PostgreSQL предоставляет широкие возможности по расширению функциональности и модификации поведения ядра СУБД через механизм расширений.
-
-В этой лекции мы рассмотрим основы создания расширений: что это такое, из каких элементов оно состоит, и создадим первое учебное расширение.
diff --git a/slides/2025 - Creating own extension/code/log.log b/slides/2025 - Creating own extension/code/log.log
deleted file mode 100644 (file)
index 5832a3c..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-Extension is a set of PostgreSQL objects that can be `CREATE`ed.
-Like `CREATE FUNCTION`, `CREATE TYPE` or `CREATE OPERATOR`.
-This set is created, updated and deleted as a bundle.
-When you do `CREATE EXTENSION` you it will create all object included into extension.
-When you do `DROP EXTENSION` all that objects will be automatically removed.
-
-So extension is just a set of SQL commands to create or update extension schema.
-(You even do not need to delete it, `DROP EXTENSION` will delete them automatically)
-
-Functions may be written in `PL/pgSQL` or other `PL/*` or you can load binary function from shared `.so` library.
-.
-You can register a function as a hook handler to change behavior if PostgreSQL.
-
-
-
-See https://github.com/IshaanAdarsh/Postgres-extension-tutorial/blob/main/SGML/Main.md for more info
-
-```
-
-$ whoami
-nataraj
-
-$ sudo -u postgres createuser -s nataraj
-```
-
-Make sure that `-dev` files for postgres are installed. In Debian-based distributives it wil
-be like this
-
-```
-sudo apt-get install postgresql-server-dev-all
-
-```
-
-
-```
-$ mkdir my_first_extension
-
-$ cd my_first_extension
-```
-
-```
-touch my_first_extension.control
-```
-
-```
-# my_first_extension.control
-# Comment line to provide additional information about the extension
-comment = 'My Very First Extension'
-
-# Specifies the default version of the extension
-default_version = '0.0.1'
-```
-
-https://www.postgresql.org/docs/17/extend-extensions.html#EXTEND-EXTENSIONS-FILES
-
-
----
-
-```
-touch my_first_extension--0.0.1.sql
-```
-
-```
-CREATE TABLE my_first_extension_table (
-  id SERIAL PRIMARY KEY,
-  my_string VARCHAR NOT NULL
-);
-
-INSERT INTO my_first_extension_table (my_string) VALUES('Hello, World');
-```
-
----
-
-```
-touch Makefile
-```
-
-```
-EXTENSION = my_first_extension           # Name of the extension
-DATA = my_first_extension--0.0.1.sql     # SQL file containing extension objects and functions
-
-PG_CONFIG  ?= pg_config                  # Path to the pg_config executable
-PGXS := $(shell $(PG_CONFIG) --pgxs)     # Get the PostgreSQL Extension Makefile from pg_config
-include $(PGXS)                          # Include the PostgreSQL Extension Makefile
-```
-
----
-
-```
-make
-sudo make install
-```
-
-```
-sudo -u postgres psql
-
-# CREATE EXTENSION my_first_extension;
-CREATE EXTENSION
-
-# SELECT * FROM my_first_extension_table;
- id |  my_string   
-----+--------------
-  1 | Hello, World
-(1 row)
-
-# DROP EXTENSION my_first_extension;
-DROP EXTENSION
-
-# SELECT * FROM my_first_extension_table;
-ERROR:  relation "my_first_extension_table" does not exist
-СТРОКА 1: SELECT * FROM my_first_extension_table;
-                        ^
-```
-
-------------
-
-# Add tests
-
-```
-mkdir sql
-```
-
-edit `sql/my_first_extension-main-test.sql`
-
-```
-CREATE EXTENSION my_first_extension;
-
-SELECT * FROM my_first_extension_table;
-
-DROP EXTENSION
-
--- There should be no my_first_extension_table anymore
-SELECT * FROM my_first_extension_table;
-```
-
-----
-
-change Makefile
-
-```
-EXTENSION = my_first_extension           # Name of the extension
-DATA = my_first_extension--0.0.1.sql     # SQL file containing extension objects and functions
-REGRESS = my_first_extension-main-test
-
-
-PG_CONFIG  ?= pg_config                  # Path to the pg_config executable
-PGXS := $(shell $(PG_CONFIG) --pgxs)     # Get the PostgreSQL Extension Makefile from pg_config
-include $(PGXS)                          # Include the PostgreSQL Extension Makefile
-```
-
-run `make installcheck`
-
-
-and get an error: `my_first_extension/expected/my_first_extension-main-test.out: No such file or directory`
-
-and a `results` dir.
-
-----
-
-Check that `results/my_first_extension-main-test.out` is what you expect
-
-```
-$ cat results/my_first_extension-main-test.out 
-CREATE EXTENSION my_first_extension;
-SELECT * FROM my_first_extension_table;
- id |  my_string   
-----+--------------
-  1 | Hello, World
-(1 row)
-
-DROP EXTENSION
--- There should be no my_first_extension_table anymore
-SELECT * FROM my_first_extension_table;
-ERROR:  syntax error at or near "SELECT"
-LINE 3: SELECT * FROM my_first_extension_table;
-        ^
-```
-
-----
-
-If everything as you expected copy `my_first_extension-main-test.out` from `results` dir to `expected` 
-```
-mkdir expected
-cp results/my_first_extension-main-test.out expected
-```
-
-----
-
-Now tests should pass
-
-```
-n$ make installcheck
-echo "+++ regress install-check in  +++" && /usr/lib/postgresql/15/lib/pgxs/src/makefiles/../../src/test/regress/pg_regress --inputdir=./ --bindir='/usr/lib/postgresql/15/bin'    --dbname=contrib_regression my_first_extension-main-test
-+++ regress install-check in  +++
-(using postmaster on Unix socket, default port)
-============== dropping database "contrib_regression" ==============
-SET
-DROP DATABASE
-============== creating database "contrib_regression" ==============
-CREATE DATABASE
-ALTER DATABASE
-ALTER DATABASE
-ALTER DATABASE
-ALTER DATABASE
-ALTER DATABASE
-ALTER DATABASE
-============== running regression test queries        ==============
-test my_first_extension-main-test ... ok           54 ms
-
-=====================
- All 1 tests passed. 
-=====================
-```
-
------
-
-Now let's create create a new version of extension, with a plpsql function in it
-
-* Change version from `0.0.1` to `0.0.2` in `my_first_extension.control`:
-
-```
-default_version = '0.0.2'
-```
-
-* rename schema creation file from `my_first_extension--0.0.1.sql` to `my_first_extension--0.0.2.sql`
-* create an schema update file `my_first_extension--0.0.1--0.0.2.sql`
-
-Add to both of them function creation code
-
-```
-CREATE FUNCTION my_one()
-returns int
-language plpgsql
-as
-$$
-begin
-   return 1;
-end;
-$$;
-
-```
-
-* Update `Makefile` adding new sql file names to `DATA` variable
-
-```
-DATA = my_first_extension--0.0.2.sql my_first_extension--0.0.1--0.0.2.sql
-```
-
-* install extension
-
-```
-sudo make install
-
-```
-
-* check everything works
-
-```
-$ sudo -u postgres psql
-
-=# CREATE EXTENSION my_first_extension;
-CREATE EXTENSION
-
-s=# SELECT my_one();
- my_one 
---------
-      1
-(1 row)
-```
-
-----
-
-Write test for `my_one` function yourself
-
-----
-
-https://www.highgo.ca/2020/01/10/how-to-create-test-and-debug-an-extension-written-in-c-for-postgresql/
-
-
-Creating C-function
-
-// Do not forget to install `postgresql-server-dev-all`
-
-create `my_first_extension.c` file
-
-```
-#include "postgres.h"
-#include "fmgr.h"
-
-PG_MODULE_MAGIC;
-
-PG_FUNCTION_INFO_V1(my_get_two);
-
-Datum
-my_get_two(PG_FUNCTION_ARGS)
-{
-    PG_RETURN_INT32(2);
-}
-```
-
-add following lines to `Makefile`
-
-```
-MODULE_big  = my_first_extension
-OBJS = my_first_extension.o
-
-```
-and to the `my_first_extension.control`
-
-
-```
-module_pathname = '$libdir/my_first_extension'
-
-```
-
-
-Check everything works well by running
-
-```
-make
-```
-
-add to schema
-```
-CREATE FUNCTION my_two()
-RETURNS INT
-AS 'MODULE_PATHNAME', 'my_get_two'
-LANGUAGE C;
-```
-
-
-bump version in *.sql files, Makefile and control file
-
-
-```
-make
-sudo make install
-```
-
-Check everything works:
-
-```
-$ sudo -u postgres psql
-
-=# DROP EXTENSION my_first_extension;
-DROP EXTENSION
-
-=# CREATE EXTENSION my_first_extension;
-CREATE EXTENSION
-postgres=# SELECT my_two();
- my_two 
---------
-      2
-(1 row)
-
-```
-
-Do not forget to write tests! 
-
-
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/Makefile b/slides/2025 - Creating own extension/code/my_first_extension/Makefile
deleted file mode 100644 (file)
index 4b14455..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-MODULE_big     = my_first_extension
-EXTENSION = my_first_extension           # Name of the extension
-DATA = my_first_extension--0.0.3.sql my_first_extension--0.0.1--0.0.2.sql my_first_extension--0.0.2--0.0.3.sql
-REGRESS = my_first_extension-main-test
-
-OBJS = my_first_extension.o
-
-
-PG_CONFIG  ?= pg_config                  # Path to the pg_config executable
-PGXS := $(shell $(PG_CONFIG) --pgxs)     # Get the PostgreSQL Extension Makefile from pg_config
-include $(PGXS)                          # Include the PostgreSQL Extension Makefile
-
-
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/expected/my_first_extension-main-test.out b/slides/2025 - Creating own extension/code/my_first_extension/expected/my_first_extension-main-test.out
deleted file mode 100644 (file)
index a0b8cc9..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-CREATE EXTENSION my_first_extension;
-SELECT * FROM my_first_extension_table;
- id |  my_string   
-----+--------------
-  1 | Hello, World
-(1 row)
-
-DROP EXTENSION my_first_extension;
--- There should be no my_first_extension_table anymore
-SELECT * FROM my_first_extension_table;
-ERROR:  relation "my_first_extension_table" does not exist
-LINE 1: SELECT * FROM my_first_extension_table;
-                      ^
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.1--0.0.2.sql b/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.1--0.0.2.sql
deleted file mode 100644 (file)
index 9c107ac..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-CREATE FUNCTION my_one()
-returns int
-language plpgsql
-as
-$$
-begin
-   return 1;
-end;
-$$;
-
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.2--0.0.3.sql b/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.2--0.0.3.sql
deleted file mode 100644 (file)
index 7b9adcd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-CREATE FUNCTION my_two()
-RETURNS INT
-AS 'MODULE_PATHNAME', 'my_get_two'
-LANGUAGE C;
-
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.3.sql b/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension--0.0.3.sql
deleted file mode 100644 (file)
index b25f223..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-CREATE TABLE my_first_extension_table (
-  id SERIAL PRIMARY KEY,
-  my_string VARCHAR NOT NULL
-);
-
-INSERT INTO my_first_extension_table (my_string) VALUES('Hello, World');
-
-
-CREATE FUNCTION my_one()
-returns int
-language plpgsql
-as
-$$
-begin
-   return 1;
-end;
-$$;
-
-
-CREATE FUNCTION my_two()
-RETURNS INT
-AS 'MODULE_PATHNAME', 'my_get_two'
-LANGUAGE C;
-
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension.c b/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension.c
deleted file mode 100644 (file)
index a126494..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "postgres.h"
-#include "fmgr.h"
-
-PG_MODULE_MAGIC;
-
-PG_FUNCTION_INFO_V1(my_get_two);
-
-Datum
-my_get_two(PG_FUNCTION_ARGS)
-{
-    PG_RETURN_INT32(2);
-}
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension.control b/slides/2025 - Creating own extension/code/my_first_extension/my_first_extension.control
deleted file mode 100644 (file)
index 68688a0..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# my_first_extension.control
-# Comment line to provide additional information about the extension
-comment = 'My Very First Extension'
-
-# Specifies the default version of the extension
-default_version = '0.0.3'
-module_pathname = '$libdir/my_first_extension'
-
diff --git a/slides/2025 - Creating own extension/code/my_first_extension/sql/my_first_extension-main-test.sql b/slides/2025 - Creating own extension/code/my_first_extension/sql/my_first_extension-main-test.sql
deleted file mode 100644 (file)
index 8992652..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-CREATE EXTENSION my_first_extension;
-
-SELECT * FROM my_first_extension_table;
-
-DROP EXTENSION my_first_extension;
-
--- There should be no my_first_extension_table anymore
-SELECT * FROM my_first_extension_table;
-