I am using PostgreSQL database and there is a field in a table(area) i.e. geog pulic.geography(Points,4326). It contains below type of records
0101000020E6100000BA83D89942334540780B24287ED051C0
I am using ST_AsGeoJson(), to get the GeoJson through above types of records.
My database is connected and I am using a query to fetch result i.e.
$query="SELECT ST_AsGeoJSON(geog) FROM area";
But I am getting below warning and not getting any results
Warning: pg_query(): Query failed: ERROR: function
st_asgeojson(public.geography) does not exist LINE 1: SELECT
ST_AsGeoJSON(geog) FROM public.area ^ HINT: No function matches the
given name and argument types. You might need to add explicit type
casts. in /home/domain/public_html/sg_database.php on line 20"
Please suggest regarding this..
Thanks
Related
I am trying to write a dataframe from R to a SQL database. When I try to append the table to the SQL dataframe, I receive the following error:
Error in result_insert_dataframe(rs#ptr, values, batch_rows) :
[Microsoft][ODBC Driver 17 for SQL Server]Invalid character value for cast specification
I understand that this is an issue with one of my field not being formatted correctly or containing incompatible values for SQL. However, it is a very large dataframe with multiple fields, and I am having trouble isolating which is the issue. Does anyone have a suggested workflow or diagnostic tools to help isolate the issue?
Main Question: Are there diagnostic tools in R to help specify/identify which field is triggering an "invalid character value for cast specification" warning when trying to append a multi-variable dataframe in R to a SQL data table?
Edit - here are the data types of the R dataframe compared with the target table:
in the camp I am at we were given an assignments to try to do some basic SQL injection.
There is a table named info with a few fields. There is a field named id, a field named sum and a field named pass.
What I am trying to do is given some id change both the sum and the pass matching that id.
What I was trying to do is:
http://a/b/c/withdraw?id=123456789&sum=7312',pass='weak
But I am getting this error:
[SQLITE_ERROR] SQL error or missing database (near "',pass='": syntax error)
When I do this:
http://a/b/c/withdraw?id=123456789&sum=7312
The sum field changes successfully, but I need to change the password matching the id as well.
Can anyone here tell me what's the problem?
I am using PostgreSQL 10 and pgAdmin-4 for learning postgreql. I am using the Sakila database.
My question is how do I select/call stored function correctly?
I tried out one stored function on the Sakila database,
SELECT inventory_in_stock(10)
without any problem.
However when I tried another,
SELECT get_customer_balance (3,NOW());
I get the following error:
ERROR: function get_customer_balance(integer, timestamp with time zone) does not exist
LINE 1: SELECT get_customer_balance(3,NOW());
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
SQL state: 42883
Character: 8
I am pulling in salesforce tables from a sql server db and the picture below shows how the data types were set. I am using the customer template and the list and detail screens work with the sample tables. However, when I change the table to dbo.case which I have converted to an internal table along with the user table which is used for employees I get the error below. I am trying to figure out why the error happens and I have only changed the tables and made the appropriate changes to map the fields in the form to the new table.
error message: Syntax Error (missing operator) in query expression '[ID]=5001...'.
Macro single step
Table setup
A string value must be wrapped in quotes:
[ID]='5001a00000a0FcRAAU'
My boss sent me a process, in to which I need to:
make a function that creates a temp table
grab data from a table
use a function to refine the data
create a hash code for 2 of the columns
insert all the data from the temp to the original data
drop the table
I've been trying to look what the make_hash() function does. Whenever I run the FUNCTION it gives me an error on that line, so I'm guessing I need to declare it first before the begin statement in the create function. Or is it a user-created function? If so, is there a way for me to find which schema the function is located?
I've been trying to research in the books and online but I couldn't find anything, even in the PostgreSQL website.
--------------------------------------------
ERROR: function make_hash(character varying) does not exist
LINE 1: UPDATE temp_match_queue_04022012 SET title_hash = make_hash(...
^
HINT: No function matches the given name and argument types. You might need to add explicit type casts.
QUERY: UPDATE temp_match_queue_04022012 SET title_hash = make_hash(as_title) WHERE as_title IS NOT NULL
CONTEXT: PL/pgSQL function "metadata_matching_temp" line 30 at SQL statement
********** Error **********
ERROR: function make_hash(character varying) does not exist
SQL state: 42883
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
Context: PL/pgSQL function "metadata_matching_temp" line 30 at SQL statement
As #Clodoaldo mentioned look into pgcrypto (which you would get by installing it to your postgres, on debian its in postgresql-contrib iirc).
Any function you call must be available before the BEGIN section. You can combine functions into packages if you need more than one.
Nevermind! The make_hash function was written psql that's why it wasn't working properly. I'm using pgAdmin III and the schema name had to be called together with the function for it to work. Thanks a bunch for the help though!