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:
@@ -93,6 +93,7 @@ smart people at [Hashrocket](http://hashrocket.com/).
|
||||
- [Timestamp Functions](postgres/timestamp-functions.md)
|
||||
- [Toggling The Pager In PSQL](postgres/toggling-the-pager-in-psql.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)
|
||||
- [Using Intervals To Offset Time](postgres/using-intervals-to-offset-time.md)
|
||||
- [Who Is The Current User](postgres/who-is-the-current-user.md)
|
||||
|
||||
35
postgres/types-by-category.md
Normal file
35
postgres/types-by-category.md
Normal 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.
|
||||
Reference in New Issue
Block a user