[SQL] session-wide autocommit off
Looks like I asked the wrong question the other day. How can I achieve a session-wide autocommit off? As it is possible inside a psql session via \unset AUTOCOMMIT I am using the libpq interface. TIA Regards, Christoph ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [despammed] [SQL] session-wide autocommit off
am 30.11.2004, um 9:40:21 +0100 mailte Christoph Haller folgendes: > Looks like I asked the wrong question the other day. > How can I achieve a session-wide autocommit off? > As it is possible inside a psql session via > \unset AUTOCOMMIT For psql i have a /etc/psqlrc: \unset AUTOCOMMIT \set AUTOCOMMIT FALSE begin; But this works only one transaction. regards, Andreas -- Andreas Kretschmer(Kontakt: siehe Header) Tel. NL Heynitz: 035242/47212 GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net ===Schollglas Unternehmensgruppe=== ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] grouping a many to many relation set
Johan Henselmans wrote: Hi, I am having a problem grouping a many to many relationship with payments and receipts, where a payment can be for multiple receipts, and a receipt can have multiple payments. I got a list of records that are involved in such relations, but now I don't know how to group them so that all payments and rececipts belonging to the same group are properly grouped. Here's the list: bankbookdetid | receiptid ---+--- 147 |25 157 |25 157 | 622 321 | 100 332 | 101 332 | 100 ... I think what's missing here is the explicit statement of which group these belong in. Without a value to sort/group by, there's nothing for your queries to "get a grip on". So - add a "group_id" column to the bank-book and receipt tables. Create a sequence to generate group id's on demand. Then you'll want a set of triggers that keeps the group details up to date. Of course, groups can shift as you add more records - particularly in the case of two groups merging when you add a "linking" row. Maybe someone smarter than me can come up with a non-procedural solution. Personally, I've got a nagging feeling that this sort of "connectedness" problem is NP, so scaling could be a problem for you. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [SQL] session-wide autocommit off
Christoph Haller wrote: Looks like I asked the wrong question the other day. How can I achieve a session-wide autocommit off? As it is possible inside a psql session via \unset AUTOCOMMIT I am using the libpq interface. Just BEGIN a transaction after connection? Or am I missing something here? -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [SQL] session-wide autocommit off
Richard Huxton wrote: > Christoph Haller wrote: > > Looks like I asked the wrong question the other day. > > How can I achieve a session-wide autocommit off? > > As it is possible inside a psql session via > > \unset AUTOCOMMIT > > I am using the libpq interface. > > Just BEGIN a transaction after connection? Or am I missing something here? > Since the server-side autocommit off was abolished in 7.4 I am looking for a session-wide replacement, meaning as long as one connection is running, after every COMMIT the next SQL-command triggers an implicit BEGIN. I know the usual answer to requests like this is "Fix Your Code", but the Release Notes on 7.4 state The server-side autocommit setting was removed and reimplemented in client applications and languages. Server-side autocommit was causing too many problems with languages and applications that wanted to control their own autocommit behavior, so autocommit was removed from the server and added to individual client APIs as appropriate. So basically, I cannot find the autocommit-off-switch within the libpg interface. TIA Regards, Christoph ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
[SQL] inserting values into types
Hi, ive generated a user defined type: CREATE TYPE qwerty_UDT AS (abc INT); & table as: CREATE TABLE t (col1 qwerty_UDT); my prob is that when i try to insert into the type i.e: INSERT INTO t (col1) Values (qwerty_UDT(123)); i get the error: ERROR: function test_x(integer) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. which is quite confusing, does anyone have any ideas or exp with this scenario, or offer help in any way? ty in advance :) -- __ Check out the latest SMS services @ http://www.linuxmail.org This allows you to send and receive SMS through your mailbox. Powered by Outblaze ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [SQL] inserting values into types
On Wed, Dec 01, 2004 at 07:51:17AM +0800, Andrew Thorley wrote: > ive generated a user defined type: CREATE TYPE qwerty_UDT AS (abc INT); > > & table as: CREATE TABLE t (col1 qwerty_UDT); Are you using 8.0? I don't think earlier versions allowed this. > my prob is that when i try to insert into the type i.e: INSERT INTO t (col1) > Values (qwerty_UDT(123)); > > i get the error: > > ERROR: function test_x(integer) does not exist This error doesn't agree with the INSERT statement you gave -- it should say "function qwerty_udt(integer) does not exist". Where does test_x() come from? Did you type the SQL statements and/or error messages instead of cutting and pasting? We can see what's happening, but it's better to paste the exact statements and output to avoid mistakes. > HINT: No function matches the given name and argument types. You may need to > add explicit type casts. See the "Composite Types" documentation -- it has a section entitled "Composite Value Input": http://developer.postgresql.org/docs/postgres/rowtypes.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org
