1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00

Add Types By Category as a postgres til.

This commit is contained in:
jbranchaud
2015-09-26 22:17:57 -05:00
parent c319efc228
commit de604d9f33
2 changed files with 36 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
- [Timestamp Functions](postgres/timestamp-functions.md) - [Timestamp Functions](postgres/timestamp-functions.md)
- [Toggling The Pager In PSQL](postgres/toggling-the-pager-in-psql.md) - [Toggling The Pager In PSQL](postgres/toggling-the-pager-in-psql.md)
- [Turning Timing On](postgres/turning-timing-on.md) - [Turning Timing On](postgres/turning-timing-on.md)
- [Types By Category](postgres/types-by-category.md)
- [Use Argument Indexes](postgres/use-argument-indexes.md) - [Use Argument Indexes](postgres/use-argument-indexes.md)
- [Using Intervals To Offset Time](postgres/using-intervals-to-offset-time.md) - [Using Intervals To Offset Time](postgres/using-intervals-to-offset-time.md)
- [Who Is The Current User](postgres/who-is-the-current-user.md) - [Who Is The Current User](postgres/who-is-the-current-user.md)

View File

@@ -0,0 +1,35 @@
# Types By Category
Postgres has many types, each of which fall into a particular category.
These categories include Array, Boolean, String, Numeric, Composite, etc.
Each of these categories has a corresponding code. For instance, numeric
types have a code of `N`. Using `N` I can get a list of all the numeric
types:
```sql
> select typname from pg_type where typcategory = 'N';
typname
-----------------
int8
int2
int4
regproc
oid
float4
float8
money
numeric
regprocedure
regoper
regoperator
regclass
regtype
regconfig
regdictionary
cardinal_number
(17 rows)
```
Check out
[`pg_type`](http://www.postgresql.org/docs/current/interactive/catalog-pg-type.html)
in the Postgres docs for a list of all categories and codes.