I originally posted the question here: http://stackoverflow.com/questions/2536727/calling-a-stored-postgres-function-from-php
I accepted the answer, but, it actually isn't working for me... Here's the original question:
I have a function in postgres, and when I'm at the pg prompt, I just do:
SELECT zp('zc',10,20,90);
FETCH ALL FROM zc...
Hello, newbie here.
I have a local Postgres database which will be filled with data (daily) on my local development machine. What is a good solution to transfer/sync/mirror this data to a production Postgres database.
For what it's worth I'm developing in Python using Django.
Thanks!
...
We're using PostgreSQL 8.2.
In our application, we heavily use a temporary table (REPORTTEMP) for report
generation purpose. All type of DML statements are performed in this table, but UPDATE
statement is comparatively very low with INSERTs and DELETEs. So, at any point
of time, after completion of the transaction, record count in th...
I am trying to query a table in PostgreSQL 8.4.2 server for to get open-high-low-close data. The table and my first query are below.
Question:
Is there a way to get the same results without using subqueries as in the example query below? Perhaps using FIRST_VALUE() or LAST_VALUE() window methods?
-- FIRST ATTEMPT AT OHLC
SELECT
con...
We used to have only one web app, but now we are breaking it down into multiple ones. Each one will be packaged as separate product (web app) Some have things in common some do not.
It was originally coded with php and using Postgresql 8.4 and CodeIgniter as the framework.
I am looking for some good suggestions on how I should set up ...
I have Order and Shipment model. Shipment has a foreign key to Order.
class Order(...):
...
class Shipment()
order = m.ForeignKey('Order')
...
Now in one of my views I want do delete order object along with all related objects. So I invoke order.delete().
I have Django 1.0.4, PostgreSQL 8.4 and I use transaction middleware...
A table has timestamp column. A sample value in that could be 2010-03-30 13:42:42. With Hibernate, I am doing a range query Restrictions.between("column-name", fromDate, toDate).
The Hibernate mapping for this column is as follows.
<property name="orderTimestamp" column="order_timestamp" type="java.util.Date" />
Let's say, I want to...
Hi,
Has anybody had any luck using Openstreetmap Amazon EBS ?
I just could not start Postgres, having created it using
pg_createcluster --locale=en_US -d /openstreetmap/data/ 8.3 osm
and then running it
pg_ctlcluster 8.3 osm start
Error:
Error: The server must be started under the locale : which does not exist any more.
Runnin...
I want to see how many rows my delete query effects so I know its correct.
Is this possible using pgadmin?
...
I have an MVC project that I would like to write in .NET 4.0
Is it possible to use Npgsql (which currently supports .net 3.5 ) if I will use it through Entity Framework, and I will limit myself to features of EF contained within 3.5?
...
If I run a select from a column in PostgreSQL that is of type enum, are the string values of the enum joined in before or after the final result set has been created? An explanation of my motive can be found at http://archives.postgresql.org/pgsql-performance/2008-07/msg00226.php
...
Hi
I have the following script to create a table:
-- Create State table.
DROP TABLE IF EXISTS "State" CASCADE;
CREATE TABLE "State" (
StateID SERIAL PRIMARY KEY NOT NULL,
StateName VARCHAR(50)
);
It runs fine in the query tool of PgAdmin. But when I try to run it from the command line using psql:
psql -U postgres -d dbname -f 0010...
How can I count the table size in MySQL or PosgreSQL using a restriction? for example: WHERE organisation_id=1
...
When I try to add a connection Linq to SQL with the OLE DB Provider : PostgreSQL OLE DB Provider I have an error message :
Unspecified error: E_OUTOFMEMORY(0x8007000E)
I don't understand what I've this message.
...
I am writing a new app with Rails so I have an id column on every table. What is the best practice for enforcing domain constraints using foreign keys? I'll outline my thoughts and frustration.
Here's what I would imagine as "The Rails Way". It's what I started with.
Companies:
id: integer, serial
company_code: char, unique, no...
I'm parsing my nginx logs, and I want to discover some details from the HTTP_REFERER string, for example, the query string used to find the web site. One user typed in "México" which gets encoded in the log as "query=M%E9xico".
Passing this through Rack::Utils.parse_query('query=M%E9xico') you get a hash, {"query" => "M?xico"}
When you...
For example I have type:
CREATE TYPE record AS ( name text, description text, tags text[])
And table:
CREATE TABLE items ( id serial, records record[] )
How can I select all items with records with tags 'test' (without using PL/pgSQL)?
...
Hi,
I want to know number of rows that will be affected by UPDATE query in BEFORE per statement trigger . Is that possible?
The problem is that i want to allow only queries that will update up to 4 rows. If affected rows count is 5 or more i want to raise error.
I don't want to do this in code because i need this check on db level.
Is...
I have a table and I'd like to pull one row per id with field values concatenated... In my table, for example, I have this:
TM67 | 4 | 32556
TM67 | 9 | 98200
TM67 | 72 | 22300
TM99 | 2 | 23009
TM99 | 3 | 11200
And, I'd like to output:
TM67| 4,9,72 | 32556,98200,22300
TM99 | 2,3 | 23009,11200
In MySQL, I was able to use GROUP_CONCA...
I'm writing an assignment which involves adding some functionality to PostgreSQL on a Solaris box. As part of the assignment, we need to print some information on the client side (i.e.: using elog.)
PostgreSQL already has lots of helper methods which print out the required information, however, the helper methods are packed with hundred...