Skip to main content

All Questions

Tagged with
0 votes
0 answers
50 views

Apache Calcite with PostgreSQL: “DECIMAL precision 0 must be between 1 and 19” Exception

I am using Apache Calcite 1.38.0 along with the PostgreSQL JDBC driver version 42.7.2. When executing an SQL query through a JdbcSchema connection to my PostgreSQL database, I encountered an exception....
Eric's user avatar
  • 1
0 votes
1 answer
73 views

Problem in converting the datatype of a column in PostgreSQL

I created a whole text table to avoid problems in the import of the csv. After that I changed the data cleanup to "," in "." as number dividers to avoid problems with the delimiter....
Simone Romualdi's user avatar
0 votes
2 answers
153 views

Why 5.0 / 2 returns 2.5000000000000000 (scale of 16) instead of 2.5 (scale of 1)?

Fiddle select 5.0 / 2 , pg_typeof(5.0 / 2); pg_typeof 2.5000000000000000 numeric Why the result is 2.5000000000000000? When we insert 2.5 into a numeric column or select 2.5 from a numeric column ...
Bek's user avatar
  • 31
0 votes
1 answer
180 views

Problem with Leetcode SQL task - Game Play Analysis IV

I'm trying to solve Leetcode SQL 50 task called "Game play analysis IV": Table: Activity player_id - int, device_id - int, event_date - date, games_played - int This table shows the ...
qanqanqan's user avatar
0 votes
2 answers
140 views

"ERROR: invalid input syntax for type numeric: NULL" postgresql

I'm starting to learn sql in porstgresql. I have create a table with numeric(6,2) structure and trying to import data. But data has some row that has NULL value. Now I'm getting "ERROR: invalid ...
Raihan Rahman's user avatar
1 vote
1 answer
339 views

Byte size of numeric(precision, scale) in Postgres

Given that the size is variable, I am trying to calculate the average cost of a numeric(p, s) attribute. In my case, numeric(10, 2). From what I understand of the Postgres documentation, this means I ...
vale383's user avatar
  • 117
0 votes
1 answer
54 views

PostgreSQL - how to implement my own casting from text to numeric

I need to write casting from text to numeric to accept values in single brackets as negative. Example: '(15)'::numeric should return -15. Creating a domain and writing a cast function would be perfect,...
aardwolf's user avatar
1 vote
1 answer
322 views

Is there any benefit in restricting a numeric field in Postgres? E.g.: numeric(70,0) instead of numeric

I'm working with large integer numbers, which I currently represent in PG using numeric(x, 0). I don't want to think about x each time, so I'm wondering: Is there any benefit (storage, performance, ...
Geert-Jan's user avatar
  • 19k
8 votes
4 answers
28k views

Postgresql 15 - Trailing junk after numeric literal error

After the Postgresql update v15, I realised that even I have a column that accepts UUID data type, it will throw me similar error like this whenever I try to Insert UUID data into the table. Script: ...
Yuki's user avatar
  • 93
0 votes
0 answers
780 views

How to import CSV files into postgresql with decimal values separted with comma instead of point?

In my zipped csv file is a column with numeric values separeted by comma. Is it possible to import the comma separted numeric value in postgresql as numeric on the file without update and type ...
Tibor's user avatar
  • 181
0 votes
2 answers
709 views

PostgreSQL calculated column not displaying numbers after decimal and rounding value to 0

I'm trying to perform a following calculation in a query: t0.value1::decimal * 10 ^ (-1 * t2.value2::decimal) * t0.value3::decimal as total_value However since (-1 * t2.value2::decimal) returns -18 ...
Enfazz's user avatar
  • 3
2 votes
2 answers
6k views

PostgreSQL (Create Table)

I am trying to create a table. One of the columns; "start_lng" meaning start longitude, includes a negative decimal number (-87.223655662). As I create my columns what kind of data type ...
A.J. Bulloch II's user avatar
0 votes
1 answer
199 views

Only numbers less than 1 exported correctly to csv Postgresql

I want to export this results: id weight ref_id multiplier cat 1 1,2 1B 1,4 380 2 0,8 1C 1 379 Where id is int8, weight and multiplier are numeric, ref_id is varchar(...
imatiasmb's user avatar
  • 121
1 vote
1 answer
1k views

postgresql: datatype numeric with limited digits

I am looking for numeric datatype with limited digits (before and after the decimal point) The function kills only digits after the decimal point. (PG version >= 13) create function num_flex( v ...
ftimmer's user avatar
  • 13
1 vote
1 answer
327 views

TO_TIMESTAMP using POSTGRESQL

How can I convert numeric to time PAYMENTDATE SELECT BANKCODE, PAYMENTDATE, Current_Date, TO_TIMESTAMP (PAYMENTDATE)::VARCHAR,'YYYYMMDD', PAYMENTDATE::VARCHAR, --TO_CHAR (TO_TIMESTAMP (PAYMENTDATE),'...
kiviko's user avatar
  • 329

15 30 50 per page