Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme. What number represents what type. #149

Closed
bbsimonbb opened this issue Jan 24, 2024 · 2 comments
Closed

Readme. What number represents what type. #149

bbsimonbb opened this issue Jan 24, 2024 · 2 comments

Comments

@bbsimonbb
Copy link

Overriding default handling to, say, parse numeric types, is a common thing to want to do, but in the call types.setTypeParser(20, function(val) { return parseInt(val, 10)}) taken from the readme, how are types identified? 20 represents what? Without this information, I'm helpless?

@sehrope
Copy link
Contributor

sehrope commented Jan 24, 2024

The 20 is an example of an OID: https://www.postgresql.org/docs/current/datatype-oid.html

The built-in types that come with PostgreSQL have well defined "low" values. Custom types created by end users have higher values and may change across servers as the exact value depends on the order of creation.

@bendrucker
Copy link
Collaborator

There is much that should be improved with this readme:

  • Tone (informal -> professional)
  • Sections (background vs. example)
  • Links (to PostgreSQL documentation)

PRs welcome and if I have some time I'll rewrite it myself. But ultimately the readme is pretty clear that these are OIDs and provides you with SQL commands to see the full set, which will tell you the corresponding number for every type in your database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants