Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-08 Thread Mike Christensen
> According to the manuals, Postgres has smallint (2 byte), integer (4 > bytes) and bigint (8 bytes)..  I use a lot of structures with "bytes" > in my code and it's kinda annoying to cast DB output from Int16 to > Byte every time, especially since there's no explicit cast in .NET an

Re: [GENERAL] JOIN column maximum

2012-01-08 Thread Alban Hertroys
On 6 Jan 2012, at 22:56, Lee Hachadoorian wrote: > What I am working with is called the summary file, which presents the data in > aggregate. That means you have an income table with 16 income classes, plus a > total column. That could be a table: income class and income. It may make sense to

[GENERAL] Foreign Key with an "OR" condition (and two concatenated columns)?

2012-01-08 Thread Phoenix Kiula
Hi. Hope I'm articulating the question correctly. I currently have a foreign key like this: "fk_table2" FOREIGN KEY (id) REFERENCES table1(id) ON DELETE CASCADE; Given the peculiar needs of this db, it seems that in some cases we will need to track the "id" of table2 against a concatenation

Re: [GENERAL] Foreign Key with an "OR" condition (and two concatenated columns)?

2012-01-08 Thread David Johnston
On Jan 8, 2012, at 9:33, Phoenix Kiula wrote: > Hi. Hope I'm articulating the question correctly. > > I currently have a foreign key like this: > >"fk_table2" FOREIGN KEY (id) REFERENCES table1(id) ON DELETE CASCADE; > > Given the peculiar needs of this db, it seems that in some cases we >

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
I'd like to backup my statement below regarding in JDBC driver from PostgreSQL: When storing fields of type BLOB it inserts the binary string in system table pg_largeobject (via user table). But when rows in user table get updated or deleted it does not update nor delete corresponding rows in tabl

[GENERAL] Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Thomas Kellerer
Stefan Keller wrote on 06.01.2012 19:04: I maintain images (from Webcams). In the Java and Hibernate (JPA) code I specified a @Lob annotation on class MyData and a attribte/data type "byte[] mydata;". Hibernate then generates two tables in PostgreSQL, one called MyData with a column mydata of typ

Re: [GENERAL] Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
2012/1/8 Thomas Kellerer wrote: > I think you are better off using bytea unless you need to access only parts > of the blob regularly. That's a valid tip. But it's to the current JDBC implementation to take action because it currently leads to disk space leakage when using JDBC and JPA/Hibernate.

Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-08 Thread Francisco Figueiredo Jr.
On Sun, Jan 8, 2012 at 06:54, Mike Christensen wrote: >> According to the manuals, Postgres has smallint (2 byte), integer (4 >> bytes) and bigint (8 bytes)..  I use a lot of structures with "bytes" >> in my code and it's kinda annoying to cast DB output from Int16 to >> Byte every

[GENERAL] Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Thomas Kellerer
Stefan Keller wrote on 08.01.2012 19:13: I think you are better off using bytea unless you need to access only parts of the blob regularly. That's a valid tip. But it's to the current JDBC implementation to take action because it currently leads to disk space leakage when using JDBC and JPA/Hib

Re: [GENERAL] Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
2012/1/8 Thomas Kellerer :> What's the reason for you to stick with LargeObjects? I simply used the @Lob annotation in Hibernate/JPA. That's all to get a leaking pg_largeobject table. See http://relation.to/Bloggers/PostgreSQLAndBLOBs, https://hibernate.onjira.com/browse/HHH-2244 and https://hiber

[GENERAL] Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Thomas Kellerer
Stefan Keller wrote on 08.01.2012 20:35: 2012/1/8 Thomas Kellerer: What's the reason for you to stick with LargeObjects? I simply used the @Lob annotation in Hibernate/JPA. That's all to get a leaking pg_largeobject table. See http://relation.to/Bloggers/PostgreSQLAndBLOBs, https://hibernate.onj

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
Thanks, Radosław, for the clarification. 2012/1/8 Radosław Smogura wrote: > 3. pg_largeobjects is system table, hibernate do not creates it. > > 4. Trigger based approach is good for this, but You need to do this mannualy That's exactly my point: Since JDBC manages creation of OID and pg_largeob

Re: [GENERAL] Re: Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
2012/1/8 Thomas Kellerer :>  So it's clearly a Hibernate bug. Obviously not :-> Hibernate mapping just uses one of two valid variants to map large objects in JDBC. So, AFAIK it's a PostgreSQL JDBC bug and an omission in the JDBC docs as well. Stefan 2012/1/8 Thomas Kellerer : > Stefan Keller wro

Re: [GENERAL] Supporting SQL/MED DATALINK

2012-01-08 Thread Peter Eisentraut
On fre, 2012-01-06 at 15:53 +0100, Damiano ALBANI wrote: > Do you plan on supporting SQL/MED features concerning DATALINKs? > I've seen DATALINK mentionned on the Wiki [1] but I couldn't find it on the > TODO list [2]. I'm not aware of any plans. What would be your use case? > By the way, do you

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Radosław Smogura
On Sun, 8 Jan 2012 18:08:09 +0100, Stefan Keller wrote: I'd like to backup my statement below regarding in JDBC driver from PostgreSQL: When storing fields of type BLOB it inserts the binary string in system table pg_largeobject (via user table). But when rows in user table get updated or delete

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Radosław Smogura
On Sun, 8 Jan 2012 21:57:37 +0100, Stefan Keller wrote: Thanks, Radosław, for the clarification. 2012/1/8 Radosław Smogura wrote: 3. pg_largeobjects is system table, hibernate do not creates it. 4. Trigger based approach is good for this, but You need to do this mannualy That's exactly my

Re: [GENERAL] Initdb fails on openwrt in "creating template1 database"

2012-01-08 Thread Clemens Eisserer
Hi, > Do you have more than one device mounted and if so are you sure you are > working > on the right one? As often, the problem turned out to be a simple one. With OpenWRT, /var is just a symlink to /tmp - which itself is located on a ramdisk. After moving the data-directory to /postgresql, e

Re: [GENERAL] Is there a reason why Postgres doesn't have Byte or tinyint?

2012-01-08 Thread Mike Christensen
On Sun, Jan 8, 2012 at 10:12 AM, Francisco Figueiredo Jr. wrote: > On Sun, Jan 8, 2012 at 06:54, Mike Christensen wrote: >>> According to the manuals, Postgres has smallint (2 byte), integer (4 >>> bytes) and bigint (8 bytes)..  I use a lot of structures with "bytes" >>> in my code an

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
2012/1/8 Radosław Smogura wrote: > Not quite, PostgreSQL doesn't have LOB, nor OID type that is only reference> > to LOB. In fact, BLOB behaviour in JDBC> is just thin wrapper for this what > is missing in PostgreSQL - BLOBs. I can't follow: PostgreSQL has bytea and LO. I'm ok with bytea too bu

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Oliver Jowett
On 9 January 2012 12:40, Stefan Keller wrote: > There's an important principle that the code which "allocates" > resources is also responsible to release it. That's one resource allocation model, yes. The other common model is that resources are freed when there are no remaining references to th

Re: [GENERAL] help... lost database after upgrade from 9.0 to 9.1

2012-01-08 Thread Craig Ringer
On 4/01/2012 11:07 PM, bbo...@free.fr wrote: so i tried to copy the old 9.0 tree to a machine with a still working 9,0 postgres, but it stops with Starting PostgreSQL 9.0 database server: mainError: could not exec /usr/lib/postgresql/9.0/bin/pg_ctl /usr/lib/postgresql/9.0/bin/pg_ctl start -D /va

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Oliver Jowett
On 9 January 2012 14:29, Stefan Keller wrote: > 2012/1/9 Oliver Jowett : >> As a LO is independent storage that might have multiple references to> it >> (the OID might be stored in many places), without explicit deletion> you >> need a GC mechanism to collect unreferenced LOs eventually -> that'

Re: [GENERAL] Duplicated entries are not ignored even if a "do instead nothing" rule is added.

2012-01-08 Thread 邓尧
I have enabled the autocommit feature of psycopg2, and removed all the transactions in source code, also changed the sql statement to the following: insert into ACCOUNT(HOME) select "v1" as HOME where not exists (select 1 from ACCOUNT where HOME = "v1") Surprisingly, I still got the uniqu

Re: [GENERAL] Binary Large Objects (LOB/BLOB) in Hibernate and JDBC: Unresolved issues

2012-01-08 Thread Stefan Keller
2012/1/9 Oliver Jowett : > As a LO is independent storage that might have multiple references to> it > (the OID might be stored in many places), without explicit deletion> you need > a GC mechanism to collect unreferenced LOs eventually -> that's what vacuumlo > etc are doing. I can follow that.

Re: [GENERAL] Time to move table to new tablespace

2012-01-08 Thread Craig Ringer
On 7/01/2012 10:52 PM, Jason Buberel wrote: I'm considering the migration of an existing large (2.3TB) table to a new tablespace. The table size, according to the '\dt+' command: public | city_summary | table | altosresearch | 2345 GB| Are there any considerations - besides the usual disk

Re: [GENERAL] Duplicated entries are not ignored even if a "do instead nothing" rule is added.

2012-01-08 Thread Jon Nelson
On Sun, Jan 8, 2012 at 7:13 PM, 邓尧 wrote: > I have enabled the autocommit feature of psycopg2, and removed all the > transactions in source code, also changed the sql statement to the > following: > > insert into ACCOUNT(HOME) >     select "v1" as HOME >     where not exists (select 1 from ACCOUNT

Re: [GENERAL] Time to move table to new tablespace

2012-01-08 Thread Ondrej Ivanič
Hi, On 8 January 2012 01:52, Jason Buberel wrote: > psql> create tablespace 'newstorage' location '/some/new/path'; > psql> alter table city_summary set tablespace = 'newstorage'; Be aware that you are not going to move indexes (see ALTER INDEX name SET TABLESPACE tablespace_name). Maybe you don

[GENERAL] Lock/deadlock issues with priority queue in Postgres - possible VACUUM conflicts

2012-01-08 Thread Chris Angelico
This has got to be a solved problem, but I can't find a simple example of what to do, nor a description of what I'm doing wrong. In this project, we need to have a disk-based priority queue, with a few snazzy features (eg limited retries and scheduling) but nothing particularly exotic. Requests ar