surrealdb / docs.surrealdb.com

The documentation for SurrealDB, powered by Docusaurus
https://surrealdb.com/docs/
60 stars 102 forks source link

Feature: Arbitrary Precision Rational - Implies Back-end Specific Data Types? #260

Closed athanclark closed 5 months ago

athanclark commented 6 months ago

Is your feature request related to a problem?

Support for an arbitrary precision rational type in fields would be convenient - libGMP and num-bigrational provide solutions to this, and BigDecimal would not suffice as a solution for numbers like 1/3.

Describe the solution

I am unsure how SurrealDB implements storage, let alone how it binds to TiKV, and what those implications must be, which is why I think it might be reasonable for some data types to be exclusive to particular backends, depending on their capabilities.

Alternative methods

I imagine it would be possible to implement the same functionality provided by the mentioned libraries directly in the database using two decimals as the numerator and denominator, using a system similar to postgres domains to declare a type, and stored procedures to perform actions like GCD reduction of a fraction, things like that.

Contact Details

athan.clark@gmail.com

Is there an existing issue for this?

Code of Conduct

Ekwuno commented 5 months ago

@athanclark I think this issues should be opened in the https://github.com/surrealdb/surrealdb. As this isn't docs related and more of a feature request I will close this issue here.