Hello
I would like to know if I'm safe against SQL injection when I use something like that with PostgresSQL:
CREATE or REPLACE FUNCTION sp_list_name( VARCHAR )
RETURNS SETOF v_player AS '
DECLARE
v_start_name ALIAS FOR $1;
r_player v_player%ROWTYPE;
v_temp VARCHAR;
BEGIN
v_temp := v_start_name || ''%'';
...
I'm using hibernate 3.0 (with posgre 8.3), Java 1.6 and Netbeans 6.5. I've created one native query to return all the unique most recent entries like this:
String query = "SELECT DISTINCT ON (origem) * FROM entrada " +
"ORDER BY origem, horadata DESC";
SQLQuery sqlQuery = this.getSession().createSQLQuery(query);
...
Accessing Tables by Name
I need to reference a table name by a string value given to me. How would I go about doing this in Postgres? Using stored procedures with PLPGSQL is an option, however other languages will be unavailable.
For example:
SELECT count(*) FROM some_function_that_returns_data_by_table_name('mytable');
I have the f...
For compliance reasons, when I delete a user's personal information from the database in my current project, the relevant rows need to be really, irrecoverably deleted.
The database we are using is postgres 8.x,
Is there anything I can do, beyond running COMPACT/VACUUM regularly?
Thankfully, our backups will be held by others, and the...
A client has outgrown their Access database, and now I need to convert it to PostgreSQL. I don't have a lot of Access experience, so at first blush it seems like the best solution is to just export the data using text files or something.
Does anyone have any good suggestions for an easy way to get the DDL and data out of Access and int...
Hello SO,
I'm hoping that someone will be able to recommend a good hosting company that provides the following environment. I know that I could just google for one, but I'm asking here first because I'm looking for someone that has previous experience working with such a company.
Linux Box.
Apache 2.0.
PHP5 (5.2.6 to be exact).
PostG...
We're developing a WebSite that's intended to have several requests per second.-
Our current environment is JavaEE, JBoss 4.2.3, Struts2 for MVC, JPA with Hibernate as ORM and Postgres as DB.-
This is the scenario: whenever a request comes to any of the pages, some action checks for information in the DB to fill the requested page (tha...
Here's my problem: I'm looking at someone's Postgresql based database application for the first time and trying to find what is causing certain warnings/errors in the system's logfile. I don't know anything about the database schema. I don't know anything about the source code. But I need to track down the problem.
I can easily search f...
There must be a better way of writing this query.
I want to select all the data between a pair of dates. Ideally the first and last rows of the result set would be those specifed in the WHERE clause. If those rows don't exist, I want the rows preceeding and following the requested range.
An example:
If my data is:
...
135321, 20090...
I'm using an STI model with a single "Accounts" table to hold information for Users and Technicians (i.e. User < Account, Technician < Account). Everything works from a functional perspective, but things explode when running unit tests:
...
8) Error:
test_the_truth(UserTest):
ActiveRecord::StatementInvalid: PGError: ERROR: relation "t...
Hi to all,
I am developing an application using QtRuby and postgresql. I sucessfully developed and running sucessfully in Linux. Now i want to run the same application in windows. But i am failing to connect to database(Postgresql). I am getting the following errors:
QSqlDatabase: QPSQL driver not loaded
QSqlDatabase: available driv...
I want to find all the names that start with numbers, weird chars (.,-#$, etc) and everything else that isn't a letter.
For example, i have 3 names: John, #1 John and 2John. What I want to get is the last 2 names. (and I don't know what weird chars the names can start, so it must be something like ![a-Z])..
I'm using postgresql.
...
I have an application built upon ASP.NET 3.5 and PostgreSQL 8.3. My database has 3 users, a data owner (xxx-owner), a data editor (xxx-editor), and a data viewer (xxx-viewer). Each user has their own schema called xxx-schema, xxx-editor-schema and xxx-viewer-schema. All the data is stored in xxx-schema.
This requires that I specify t...
Earlier I had asked the question:
Where (or how) should I define the schema in a select statement when using PostgreSQL?
The answer I accepted was to modify the search_path for the connecting user so that the schema need not be specified in the SQL. However, now I wonder if I should always specify the schema in SQL rather than allow th...
I am somewhat new to transactional databases and have come across an issue I am trying to understand.
I have created a simple demonstration where a database connection is stored inside each of the 5 threads created by cherrypy. I have a method that displays a table of timestamps stored in the database and a button to add a new record...
There is a note in 8.3 doc which explain why my company application is broken after I upgraded Postgresql from 8.1 to 8.3.
Is there an easy way of altering 8.3 version to behave like 8.1? For example: now with 8.3 when I pass data type to the substr function as first argument then I get an error. 8.1 version silently converted data valu...
Tried select to_ascii('capo','LATIN1'), to_ascii('çapo','LATIN1') and the results are different....
...
I have a table with a lot of rows and I have changed the function associated with the trigger in insert or update events. This function makes calculations to update columns with conditional logic according to the values in two or more cells, so an single update statement would not be useful.
So, which SQL statement can I use to re-execu...
I'm trying to drop a database from PgAdmin 3 and I get this error message:
ERROR: can't delete current database
SQL state: 55006
how can I force the delete/fix this error, of this database?
...
I've heard a lot of PostgreSQL but I always wanted to know why you'd choose it over MySQL. What makes it "the world's most advanced" and do those "advanced" features really matter?
...