Extensions
- my_extension 1.0.1
README
Contents
my_extension
Overview
my_extension is a basic PostgreSQL extension that provides additional functionality for efficient data manipulation and calculations.
Features
- Create a custom table
my_tablewith an auto-incrementingidcolumn and anamecolumn. - Implement a function
add(a, b)that returns the sum of two integers. - Implement a function
complex_add(numbers)that returns the sum of multiple integers provided as an array.
Installation
Requirements
- PostgreSQL (version 9.6 or later)
- Git
Steps
Clone the repository:
git clone https://github.com/IshaanAdarsh/Postgres-extension-tutorial/tree/main/Code/my_extensionChange to the extension directory:
cd my_extensionBuild and install the extension:
make make installEnable the extension in your PostgreSQL database:
CREATE EXTENSION my_extension;
Usage
Creating a custom table
Table is created when the extension is Created automatically with an auto-incrementing id column and a name column.
Adding two numbers
To add two numbers using the add function, execute the following SQL query:
SELECT add(1, 2);
Adding multiple numbers
To add multiple numbers using the complex_add function, provide an array of integers and execute the following SQL query:
SELECT complex_add(ARRAY[1, 2, 3, 4, 5]);
Contributing
Contributions are welcome! If you have any suggestions, bug reports, or feature requests, please open an issue or submit a pull request.
License
This project is licensed under the PostgreSQL License.