Hi,
I use this query to select products from my database. Performing this query takes ~0.220ms. If I remove the 3 lines where the number_percentage() function is used everything is fast (~0.07ms or less).
SELECT
DISTINCT ON (p.id) p.id AS product_id,
pv.price,
number_percentage(pv.price,t.percentage) AS price_vat,
number_percentage...
Hi,
I am writting postgres application using libpq C library and planning to use pg_service.conf file for database connection settings(like host, port etc.). Default path for this file is "etc/pg_service.conf". I want to change this path to some other directory. Can we change it?
I know one option to do this is to set 'PGSYSCONFDIR' ...
I am trying to find the equivalent SQL of \dT using the information_schema and can't seem to find anything. Does such a thing exist?
Example: If I add the following custom type enum, how can I see it in the information_schema?
CREATE TYPE communication.channels AS ENUM
('text_message',
'email',
'phone_call',
'broadcast'...
The software stack I'm using is: tomcat->spring-> hibernate-> DBCP -> postgreSQL
I have a query that search for some data using a column of type "timestamp without time zone".
If the application is tested in a single user mode, then there are no problems.
I'm using JMeter to make some stress test and can see that sometimes the query f...
Consider the following snippet of Python code:
from sqlalchemy import *
from sqlalchemy.orm import *
db = create_engine('postgresql:///database', isolation_level='SERIALIZABLE')
Session = scoped_session(sessionmaker(bind=db, autocommit=False))
s = Session()
s.add(SomeInstance())
s.flush()
raw_input('Did it work? ')
It connects to the ...
Hi,
Please, excuse me in advance for my poor english as it is not my mother tongue.
We have a national application & the users would like to have accurate business statistics regarding some tables.
We are using tomcat, Spring Ws & hibernate on top of that.
We have think about many solutions :
plain old query for each user req...
Hallo,
I tried to send the request to PostgreSQL 8.x that has character encoding SQL_ASCII. Sadly I can not convert it to UTF-8 in any way: neither sending connection properties client_encoding=UTF8 using springframework, nor "SET CLIENT_ENCODING = 'UTF8';" directly in jdbc transaction - nothing helps.
On setting client encoding in jd...
Hi,
I randomly see the same error in the catalina.out log:
WARNING: SQL Error: 0, SQLState: 25P02
Sep 8, 2010 11:50:13 PM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: ERROR: current transaction is aborted, commands ignored until end of transaction block
org.hibernate.exception.GenericJDBCException: could not execute qu...
I want to select some rows based on certain criteria, and then take one entry from that set and the 5 rows before it and after it.
Now, I can do this numerically if there is a primary key on the table, (e.g. primary keys that are numerically 5 less than the target row's key and 5 more than the target row's key).
So select the row with ...
Until recently, I've used MySQL for all my database needs in all my server projects.
However, after Oracle came along and bought MySQL, there seems to be some uncertainty about the future of MySQL.
So I'm left wondering whether I should stick to MySQL (which I'm fairly familiar with), or should I switch to something like PostgreSQL. An...
In our project we benefit a lot from the inheritance feature of the PostgreSQL database!
We implement the dynamical creation of schemes for different agencies. This structure permits us to solve a lot of security issues which occurs immediately in the case of bulk tables (without partitioning).
The only problem we encountered is to gu...
I designed a set of tables in pgAdmin3. I gave names like Products and ProductRID. I was very surprised though when I went to query this table only to find a query like this yielded unknown relation:
select * from Products
Apparently the proper way to access this is
select * from "Products"
which is very ugly. I can rename the tab...
When i am running my query
$dbhost='localhost';
$dbuser='dbuser';
$dbpass='dbpass';
$dbname='dbname';
$conn=pg_connect('host='.$dbhost.' dbname='.$dbname.' user='.$dbuser.' password='.$dbpass);
if (!$conn) {
echo "An error occured.\n";
exit;
}else{
echo "connection occured";
}
echo $conn;
$insert=pg_query($conn, "Insert...
jkdfhdjfhjh&name=ijkjkjkjkjkjk&id=kdjkjkjkjkjkjjjd&class=kdfjjfjdhfjhf
The above string has some characters starting with & and ending with =
for example we have &name= and I just need this from the above string.
similarly I need &id=, &class=
I need the output under a single column.
Final Extract
----------------------
&id=, &class...
I was looking for a two years old version of PostGIS because I need to import data from an existing remote database and it won't let me make an exact mirror of the database, I need to install PostGIS locally before transferring data and being able to upgrade locally.
The problem is that version is no longuer available and I can't seem t...
I'm doing
using(var scope = new TransactionScope())
{
//lots of calls to sql server
scope.Complete();
}
and it works like a transaction
I would like to know if it is going to work the same with postgres ?
...
When i am runing mu insert query too insert into database i am getting an error message like ..
ERROR: permission denied for relation advertiser_regidetdir
How will i resolve this? thanks
...
I have an application using hibernate 3.1 and JPA annotations. It has a few objects with byte[] attributes (1k - 200k in size). It uses the JPA @Lob annotation, and hibernate 3.1 can read these just fine on all major databases -- it seems to hide the JDBC Blob vendor peculiarities (as it should do).
@Entity
public class ConfigAttribut...
Hi,
Folowing this question by CountZero, apparently i'm facing same problem here.
When my site trying to open connection with the database, SOMETIME (Not Always) i get following error:
Warning: pg_connect()
[function.pg-connect]: Unable to
connect to PostgreSQL server: server
closed the connection unexpectedly
This probably ...
I have a postgresql (V 8.4) function that returns SETOF a custom type. An example of the string output from this function is the following 4 rows:
(2,"CD,100"," ","2010-09-08 14:07:59",New,0,,,,,,"2010-09-06 16:51:51","2010-09-07 16:51:57",)
(5,CD101,asdf,"2010-08-08 14:12:00",Suspended-Screen,1,10000,,,,,,,)
(4,DNR100,asdf,"2010-09-08...