As you already have specified into your question, the coordinates must be expressed following the "latlng" order, therefore I suggest you to store the data in your table in the proper oder (the longitude
first and the latitude
second).
Using this logic, your second statement must be reformulated as below:
SELECT *
FROM Entries
WHERE ST_Within(
Entries.latlng::geometry,
ST_GeomFromText(
'POLYGON((
-121.32521530382634 45.61490708797995,
-121.32338469617367 45.61490708797995,
-121.32338469617367 45.615492910571655,
-121.32521530382634 45.615492910571655,
-121.32521530382634 45.61490708797995))',
4326)
Also, you must to assure yourself your "latlng" colum is really of geometry type (for example a point). If this is you case, then you simply may specify the column name
latlng
instead of
Entries.latlng::geometry
But, if your "latlng" column looks like this:
POINT(-121.32 45.61)
then, you must use
ST_GeomFromText(latlng, 4326)
If column in your table has explicitly defined geometry type and srid, like:
CREATE TABLE geom_table (id serial, geom geometry(point,3857);
Your database will not allow to place there any other geometries than point in srid 3857... but you can also define table like this:
CREATE TABLE geom_table (id serial, geom geometry);
Than you can store there different geometries in different srids.
You can use ST_GeometryType and ST_SRID to find out what is in this column:
SELECT DISTINCT ST_SRID(geom) FROM table;
SELECT DISTINCT ST_GeometryType(geom) FROM table;
Best Answer
From Postgis doc:
So you shoud have a row in GEOMETRY_COLUMNS table for F_TABLE_SCHEMA 'public', F_TABLE_NAME 'mytable' and F_GEOMETRY_COLUMN 'mycolumn' where the SRID is 0. You can update this row with the correct SRID.