I am quite new to PostgreSQL and pgadmin. I have created a table named "indication" with one double precision [] column. Whenever I attempt to save any double precision array data (typed here as "{23.2, 25.1}", pgadmin gives me the following error:
ERROR: operator does not exist: double precision[] = text[] LINE 3: "Size" = ARRAY['23.2','25.1'] HINT: No operator matches the given name and argument type(s). You might need to add explicit type casts.
I'm not sure what to do here. I can use command line PSQL if necessary, but I prefer to add data via GUI.
Here's a screenshot of my error:
Can you try updating using syntax like {23.2, 25.1}
Related
I have a Postgresql (version 10) database, hosted on Amazon RDS. I was trying to experiment with the earthdistance module - everything I read says that the module should be available, but the server is acting like it doesn't exist.
=> select earth_distance(ll_to_earth(42.1, 19.1), ll_to_earth(42.2, 19.2));
ERROR: function ll_to_earth(numeric, numeric) does not exist
LINE 1: select earth_distance(ll_to_earth(42.1, 19.1), ll_to_earth(4...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
=> select ll_to_earth(42.1, 19.1) ;
ERROR: function ll_to_earth(numeric, numeric) does not exist
LINE 1: select ll_to_earth(42.1, 19.1) ;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
=> select earth() ;
ERROR: function earth() does not exist
LINE 1: select earth() ;
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
I ran SHOW rds.extensions, and earthdistance does show up in the list. So what am I missing? Do I have to do something to activate this module?
You have to do create extension earthdistance in order to use it. Just because the binaries and scripts exist doesn't mean they are active.
I am trying to run this query:
select *
from my_table
where column_one=${myValue}
I get the following error in Datagrip:
[42883] ERROR: operator does not exist: character varying = bigint Hint: No operator matches the given name and argument types. You might need to add explicit type casts.
Now, I have found this question, and I can fix the error by putting a string like this:
select *
from my_table
where column_one='123'
What I need is a way to pass in the '123' as a parameter. I usually do this ${myValue} and it works, but I am not sure how to keep my variable there as an input so I can run dynamic queries in code and let Postgres understand I want to pass in a string and not a number.
Any suggestions?
Here's a screenshot of how I am putting the parameter value in DataGrip...:
Ok, so, I just tried to put quotes in the data grip parameters input field for myValue #thirumal's answer things work. I didn't know I have to quote the value for it to work.
This is what it looks like:
Type cast ${myValue} using SQL Standard,
cast(${myValue} AS varchar)
or using Postgres Syntax:
${myValue}::varchar
I am trying to use the current_setting() and set_config() functions for plpgpsq, to change the value of a custom setting I've added to my postgresql.conf file.
Here's what I added to the end of my postgresql.conf file :
IntegrityPackage.NestLevel = 0
After restarting the PostgreSQL service, here's what I get when I want to see the setting's value :
select current_setting('IntegrityPackage.NestLevel');
current_setting |
----------------|
0 |
However, when I try to edit the value, I get an error message :
select set_config('IntegrityPackage.NestLevel', 0, false);
ERROR: function set_config(unknown, bigint, boolean) doesn't exist.
Hint: No function corresponds to given name and argument types
You must add explicit type conversions
(Vaguely translated from french since the error message was in french)
There is very little documnetation about this, therefore I'm stuck and I can't think of another way to do this.
Edit - the exact error text (in psql 9.2 / postgresql 10.0) is:
ERROR: function set_config(unknown, integer, boolean) does not exist
LINE 1: select set_config('my.foo',obj_id::int ,false) from objects ...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
This will work:
select set_config('IntegrityPackage.NestLevel', '0', false);
Below statmen generated from h2
INSERT INTO EPSG_ALIAS
(ALIAS_CODE, OBJECT_TABLE_NAME, OBJECT_CODE, NAMING_SYSTEM_CODE, ALIAS, REMARKS)
VALUES
(1431, 'Datum', 6123, 7300, STRINGDECODE('Kartastokoordinaattij\ufffdrjestelm\ufffd (1966)'), NULL);
When i execute the above statment in postgresql i am getting following error.
ERROR: function stringdecode(unknown) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Character: 140
STRINGDECODE is the way of H2 to read 'ASCII written UTF-8 characters'.
For Postgres, it's a simple 'E' before your string:
STRINGDECODE('Kartastokoordinaattij\ufffdrjestelm\ufffd (1966)')
Becomes
E'Kartastokoordinaattij\ufffdrjestelm\ufffd (1966)'
I have the following statement that I need to run on a table which has a geometry column. I am getting a WKT from Oracle using my C# program and then attempting to insert it into PostgreSQL using an npgsql connection.
highways=# INSERT INTO cluster_125m (CELL_GEOM)
VALUES(ST_GeomFromWKT('POLYGON ((80000.0 17280.0, 80125.0 17280.0, 80125.0 17405.0, 80000.0 17405.0, 80000.0 17280.0))'));
I get the following error:
ERROR: function st_geomfromwkt(unknown) does not exist
LINE 1: INSERT INTO cluster_125m (CELL_GEOM) VALUES(ST_GeomFromWKT('...
^
HINT: No function matches the given name and argument types. You might need to
add explicit type casts.
What is the issue here and what can be done about it?
Use function ST_GeomFromText instead of ST_GeomFromWKT.