• Stars
    star
    231
  • Rank 173,434 (Top 4 %)
  • Language
    Python
  • License
    Other
  • Created almost 11 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

unsigned integer types extension for PostgreSQL

Unsigned and other extra integer types for PostgreSQL

This extension provides additional integer types for PostgreSQL:

  • int1 (signed 8-bit integer)
  • uint1 (unsigned 8-bit integer)
  • uint2 (unsigned 16-bit integer)
  • uint4 (unsigned 32-bit integer)
  • uint8 (unsigned 64-bit integer)

Installation

PostgreSQL version 9.1 or later is required. Currently, only 64-bit builds are supported.

To build and install this module:

make
make install

or selecting a specific PostgreSQL installation:

make PG_CONFIG=/some/where/bin/pg_config
make PG_CONFIG=/some/where/bin/pg_config install

And finally inside the database:

CREATE EXTENSION uint;

Using

You can use the new types like the standard integer types. Examples:

CREATE TABLE foo (
    a uint4,
    b text
);

SELECT * FROM foo WHERE a > 4;

SELECT avg(a) FROM foo;

The types come with a sizable set of operators and functions, index support, etc. Some pieces are still missing, but they are being worked on. If there is anything you can't find, let me know.

Discussion

Support for unsigned integer types and smaller integer types has been one of the more common outstanding feature request for PostgreSQL. Inclusion of additional integer types into the core is typically rejected with the argument that it would make the type system too complicated and fragile. The experience from writing this module suggests: That is not wrong. Another argument, either explicit or implicit, is that it is a lot of work. Again: true.

The combination of the requirements of the SQL standard and the type system of PostgreSQL effectively create a situation where you need to provide a comprehensive set of operators and functions for each combination of numeric types. So for the three standard integer types, that's 9 "+" operators, 9 "<" operators, and so on. And with 3 + 5 = 8 types, well, you do the math. This module solves that problem by generating most of the code automatically.

The purpose of this module is therefore twofold: First, it should be useful in practice. There is no reason why it couldn't be. Second, it is a challenge to the PostgreSQL extension mechanism. In that area, there are various "interesting" problems that still need to be worked out.

Testing

In addition to the test suite of this module (make installcheck), it is useful to test this module by running the main PostgreSQL regression tests while this module is loaded, which should not fail. This will verify that the presence of the additional types and operators will not cause changes in the interpretation of expressions involving the existing types and operators.

More Repositories

1

pguri

uri type for PostgreSQL
C
297
star
2

homebrew-postgresql

🐘 PostgreSQL formulae for the Homebrew package manager
Ruby
288
star
3

plsh

PL/sh is a procedural language handler for PostgreSQL that allows you to write stored procedures in a shell of your choice.
C
154
star
4

pex

light-weight package manager for PostgreSQL
Shell
95
star
5

postgresqlfs

FUSE driver to access PostgreSQL databases as a file system
C
80
star
6

pgemailaddr

email address type for PostgreSQL
C
43
star
7

git-whoami

essential Git command
Shell
24
star
8

pgtrashcan

PostgreSQL trash can
C
23
star
9

homebrew-auto-update

automatically runs brew update
Shell
22
star
10

plxslt

XSLT procedural language for PostgreSQL
C
18
star
11

pgpcre

PCRE functions for PostgreSQL
C
17
star
12

getent-osx

simplistic getent tool emulation for OS X
Perl
14
star
13

pex-packages

package library for pex (https://github.com/petere/pex)
13
star
14

veung

visual explain ΓΌber-next generation (for PostgreSQL)
Python
12
star
15

postgresql-common

PostgreSQL database-cluster manager β€” You might be interested in https://github.com/petere/homebrew-postgresql as well.
Perl
12
star
16

homebrew-sgml

SGML tools for Homebrew
Ruby
10
star
17

autopex

PostgreSQL extension installation magic
C
9
star
18

pglockviz

tool to visualize PostgreSQL locks
Python
8
star
19

plpydbapi

Python DB-API interface on top of PL/Python
Python
7
star
20

pgbloomagg

Bloom filter aggregate function for PostgreSQL
PLpgSQL
7
star
21

logging-hooks-presentation

material for presentation about logging hooks in PostgreSQL
Puppet
7
star
22

adventofcode-2020

https://adventofcode.com/2020
Raku
6
star
23

pgci

continuous integration service for PostgreSQL
Python
4
star
24

markdown-formatter-for-chrome

extension for Google Chrome that formats Markdown text as HTML
JavaScript
4
star
25

pgvihash

version-independent hash functions for PostgreSQL
C
4
star
26

emacs-save-packages

save and restore installed ELPA packages
Emacs Lisp
4
star
27

pglogjsonsrvgo

pg_logforward JSON consumer written in Go
Go
2
star
28

peter.eisentraut.org

Peter Eisentraut's blog
Ruby
2
star
29

emacs-ssh-file-modes

Emacs major modes for ssh authorized_keys and known_hosts files
Emacs Lisp
2
star
30

debnorepo

find installed Debian packages without repository
2
star
31

pglibuuid

PostgreSQL wrapper for libuuid (obsolete, use PostgreSQL's configure --with-uuid=e2fs for equivalent functionality)
C
2
star
32

sgml-spell-checker

SGML spell-checking package
Shell
2
star
33

pgcatviz

generate schema diagram of PostgreSQL system catalogs using Graphviz
Python
2
star
34

my-gettext-scripts

some small wrapper scripts around gettext tools
Shell
1
star
35

updatable_views

updatable views extension for PostgreSQL
C
1
star
36

samsung-q45-support

support for Samsung Q45 laptops on Debian/Ubuntu
1
star
37

sgml-spell-checker-word-lists

additional word lists to use with sgml-spell-checker
Makefile
1
star
38

plpylint

runs pylint over PostgreSQL PL/Python functions
Python
1
star
39

emacs-eruby-mode

Emacs minor mode for eRuby template (.erb) files
Emacs Lisp
1
star
40

nodes-cookbook

Chef cookbook to store node attributes in data bag items
Ruby
1
star
41

commitfest-tools

tools for messing with PostgreSQL commit fests
Python
1
star
42

adventofcode-2021

πŸŽ„
Python
1
star
43

homebrew-icu

ICU formulae for the Homebrew package manager
Ruby
1
star