I'd like to do different operations on the data returned from a single sql query, something like this:
$sql = "SELECT * FROM mandant";
$res = pg_query($_db,$sql);
while ($mandant_list = pg_fetch_object($res))
{
# do stuff
}
while ($mandant = pg_fetch_object($res))
{
# do other stuff
}
But this doesn't work. The fir...
I have a varchar column in Postgres 8.3 that holds values like: '0100011101111000'
I need a function that would consider that string to be a number in base 2 and spits out the numeric in base 10. Makes sense?
So, for instance:
'000001' -> 1.0
'000010' -> 2.0
'000011' -> 3.0
Thanks!
...
Hi all,
I'm trying to create a system in Python in which one can select a number of rows from a set of tables, which are to be formatted in a user-defined way. Let's say the table a has a set of columns, some of which include a date or timestamp value. The user-defined format for each column should be stored in another table, and querie...
I'm new to Postgres and SQL. I created the following script that draws a line from a point to a projected point on the nearest line. It works fine on a small data set 5 to 10 points with the same number of lines; however, doing it on 60 points with 2,000 lines, the query takes about 12 hours. it is based on a nearest neighbour function p...
Possible Duplicate:
How do I find the last time that a PostgreSQL database has been updated?
I need to be able to determine when the last time a database table was modified.
I have seen the usage of sys.dm_db_index_usage_stats and last_user_update
but this is not available in PostgreSQL. Is there similar functionality in Postgre...
I'm trying to be as lazy as possible by generating a series of SQL commands in a file to feed to psql for processing. In a nutshell, I'm loading a series of import tables from outside sources (already done, via COPY), and then in a final step, deleting/updating/inserting records into the primary tables (which is functionally also done).
...
I have an application that is using Hibernate 3, c3p0, and spring 2.5.6. We have a datasource that is configured to speak with a postgres database. Everything was working great until a firewall was introduced between the application server and the database. We intermittently are getting java.net.SocketTimeoutException: Read Timed Out err...
In the documentation for postgresql.conf, it implies that they envisage a scenario where one might want to store the configuration files in a non-default location (i.e. not inside the data directory). This is done by passing the location of the config files when starting up the server as postgres -D /path/to/config/directory, and having...
hi there,
what is the easiest way to save PL/pgSQL output from a PostgreSQL database to a csv file? I'm using PostgreSQL 8.4 with pgAdmin III and psql plugin where I run queries from...
thanks!
martin
...
I have a dataset that contains:
Table { date itemName }
The date for the most part is sequential. There are no duplicates of the date [as it is the primary key].
The question is split up into multiple parts (all with respect to using SQL):
Is it possible to find gaps in the date series listed in the table?
For example: Dates 1/2/09...
Does PostgreSQL support Transparent Data Encryption (TDE)? We are planning to use PostgreSQL for our remote clients, but are worried that the data files can be copied and a new instance of the database can be recreated on an unauthorized machine. TDE solves this problem.
But we're not sure if PostgreSQL supports TDE -- does it?
...
We've got a web-based application. There is a time-bound database operation (INSERTs and UPDATEs) in the application which takes more time to complete, hence this particular flow has been changed into Java Thread so it will not wait (block) for the complete database operation to be completed.
My problem is, if more than 1 user come a...
Our shop has developed a few WEB/SMS/DB solution for a dozen client installations. The applications have some real-time performance requirements, and are just good enough to function properly. The problem is that the clients (owners of the production servers) are using the same server/database for customizations that are causing problems...
Is it possible to get a history of queries made in postgres? and is it be possible to get the time it took for each query? I'm currently trying to identify slow queries in the application I'm working on.
I'm using Postgres 8.3.5
...
How do I cancel a long running postgres query via JDBC or Java?
The usecase would be that an user starts a query on a postgres database
via a front end, but then he decides otherwise and wants to
abort/cancel the currently running query.
...
I've installed Npgsql Data Provider for .net and I've executed
gacutil -i Npgsql.dll
as the user manual said, but I can't use the Dataset designer. When I add a TableAdapter to the designer, It ask me for a new connection, but the options are Access, MS Sql, or SQLite (other dataProviders that already i have installed). There's no op...
We're considering using SSIS to maintain a PostgreSql data warehouse. I've used it before between SQL Servers with no problems, but am having a lot of difficulty getting it to play nicely with Postgres. I’m using the evaluation version of the OLEDB PGNP data provider (tiny.cc/qLoS2).
I wanted to start with something simple like UPSERT o...
Has anyone gotten Grails working with Postgres? I have used this tutorial and everything seems to make sense and be correct to me. However when I 'grails run-app' I get this error
Cannot create JDBC driver of class 'org.postgresql.Driver' for connect URL 'jdbc:postgres://10.0.0.21/tribes'
java.sql.SQLException: No suitable driver
My D...
From time time to time my PostgreSQL DB is reporting a strange error:
[client] postgres7 error: [-1: ERROR: invalid byte sequence for encoding \"UTF8\": 0xb4
HINT: This error can also happen if the byte sequence does not match the encoding expected by the server, which is controlled by \"client_encoding\".] in adodb_throw(INSERT INT...
I have a PostgreSQL function that selects data and returns it via a refcursor, similar to the following declaration:
CREATE OR REPLACE FUNCTION my_function()
RETURNS refcursor AS
...
How do I retrieve data from this function via a CodeIgniter model? I can't just SELECT directly from the function as it does not return the data dire...