Re: [GENERAL] Iis there anyway to do this(see in message)

2005-01-16 Thread Michael Fuhr
asier. > I get a lot of requests from former MS SQL server DBAs/developers for > such capablility. People request a trace feature for PL/pgSQL from time to time but I don't think anybody has implemented it yet. I'm sure a patch would be welcome --

Re: [GENERAL] pgpsql help

2005-01-16 Thread Michael Fuhr
the name of a table and a column in that table. Use a different name for the variable. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail

Re: [GENERAL] deleting from arrays

2005-01-16 Thread Michael Fuhr
e}'::text[] - 'carol'; ?column? - {bob,ted,alice} (1 row) SELECT '{2,3,5,7}'::int[] - 3; ?column? -- {2,5,7} (1 row) -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)---

Re: [GENERAL] PQexecParams and CURSOR

2005-01-17 Thread Michael Fuhr
fails because you're passing a parameter that the FETCH statement doesn't need (you're passing 1 as the nParams argument and the parameter list as paramValues). Use one of the other two methods, either PQexec() or PQexecParams() with nParams set to 0 and pass NULL instead of pa

Re: [GENERAL] PQexecParams and CURSOR

2005-01-17 Thread Michael Fuhr
ound for parameter 1 LOCATION: ExecEvalParam, execQual.c:518 I think the following message to pgsql-commiters announces the fix that was applied to the development branch, which will soon be released as 8.0.0: http://archives.postgresql.org/pgsql-committers/2004-08/msg00028.php -- Michael Fuhr

Re: [GENERAL] Logging question

2005-01-17 Thread Michael Fuhr
e logging for a particular session, execute the appropriate "SET log_statement" statement in that session. If you have permission problems then you could wrap that operation in a function defined as SECURITY DEFINER and create the function as a database superuser. -- Mic

Re: [GENERAL] Logging question

2005-01-17 Thread Michael Fuhr
ert into foo values (3); Response INSERT 0 1 Request select * from foo; Response 1D 2D 3C SELECT -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] Logging question

2005-01-17 Thread Michael Fuhr
on to read the log file if you know where it is. That would be easy in a language like PL/Python or PL/Perl. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Logging question

2005-01-17 Thread Michael Fuhr
for the reminder. And yep, there it is, right at the top of the ALTER DATABASE documentation...that's what I get for not checking. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 9: the planner will ignore your des

Re: [GENERAL] Users and unique identifyers

2005-01-17 Thread Michael Fuhr
users; id | name +-- 1 | 2 | (2 rows) SELECT * FROM users_private; ERROR: permission denied for relation users_private Even without encryption this would be a way to hide the names, although it might not be secure enough for your needs.

Re: [GENERAL] Multiline plpython procedure

2005-01-17 Thread Michael Fuhr
et this: % ./foo File "", line 1 print 'What hath' ^ SyntaxError: invalid syntax I don't know if that behavior is configurable or not. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] Multiline plpython procedure

2005-01-18 Thread Michael Fuhr
et simple tests show that normal scripts run on Unix-like platforms regardless of whether their lines end in LF, CRLF, or CR. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] Change type

2005-01-18 Thread Michael Fuhr
On Tue, Jan 18, 2005 at 07:01:45PM +, Vladimir S. Petukhov wrote: > I want to dinamcly change type of column. If possible, of course. The FAQ discusses this: http://www.postgresql.org/files/documentation/faqs/FAQ.html#4.4 -- Michael Fuhr http://www.fuhr.org/~mf

Re: [GENERAL] Problem getting sql statement logging to work

2005-01-18 Thread Michael Fuhr
reSQL backend so it knows about the configuration changes, and try again. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [GENERAL] Is initdb needed from 8.0.0rc3 to 8.0.0?

2005-01-18 Thread Michael Fuhr
x27;t expect an initdb to be required to move to 8.0.0. But don't hold me to that -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] Retrieving a field from the NEW record

2005-01-18 Thread Michael Fuhr
s in a PL/pgSQL trigger. I didn't think EXECUTE would work and indeed it doesn't, at least not the way I tried: ERROR: NEW used in query that is not in a rule -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)-

Re: [GENERAL] Multiline plpython procedure

2005-01-18 Thread Michael Fuhr
> handling of newlines. If Python's behavior is intentional then the newline burden would seem to be on the user or on plpythonu. I think Tom's point is that that's just silly -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--

Re: [GENERAL] PL/PgSQL Index Usage with Trigger Variables

2005-01-18 Thread Michael Fuhr
.6 and 8.0.0 and an UPDATE statement like the one above did appear to be using an index from a trigger. Note that the plan for the UPDATE is logged only the first time it's executed in a session, presumably because subsequent calls to the function use a cached plan. -- Michael

Re: [GENERAL] update in triggers

2005-01-18 Thread Michael Fuhr
urn null; > end; > 'LANGUAGE 'plpgsql' IMMUTABLE CALLED ON NULL INPUT SECURITY INVOKER; A function that has side effects like updating a table should be VOLATILE, not IMMUTABLE. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Getting table metadata

2005-01-18 Thread Michael Fuhr
see, it takes a lot of information from the system catalogs to generate a description of a table. The Information Schema abstracts these queries through views, so querying them might be the easiest way if they provide what you need. See in particular information_schema.columns. -- Michael Fuhr ht

Re: [GENERAL] update in triggers

2005-01-18 Thread Michael Fuhr
RT INTO foo (name) VALUES ('Jamie'); SELECT * FROM foo; id | name | notes ----+---+--- 1 | Jamie | hello (1 row) -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [GENERAL] update in triggers

2005-01-18 Thread Michael Fuhr
S' with different identifiers quoted. See the documentation for quoted identifiers: http://www.postgresql.org/docs/7.4/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 3: if postin

Re: [GENERAL] PL/PgSQL Index Usage with Trigger Variables

2005-01-19 Thread Michael Fuhr
e you sure you're looking at the right DETAIL? Adding some RAISE INFO or RAISE DEBUG statements can help you pinpoint which log output belongs to which part of the function. I just wrote a test function that used EXECUTE to do an UPDATE and a SELECT loop and saw INDEXSCAN in the relevant DETAIL

Re: [GENERAL] Retrieving a field from the NEW record

2005-01-19 Thread Michael Fuhr
submit > a bug report with a test case. Please do, but try 8.0.0 first. I don't know how stable PL/Perl is on Windows, but there have been bug fixes in PL/Perl since the 8.0.0beta2 version you said you were running. -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [GENERAL] plpythonu on 7.4

2005-01-21 Thread Michael Fuhr
74/lib/plpython.so" show? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [GENERAL] plpythonu on 7.4

2005-01-21 Thread Michael Fuhr
PyDict_Copy() function. The only newer version is 2.4, and it was released in late November. I was wondering if it was a dynamic linking issue, like plpython.so not finding libpython*. Does PostgreSQL's configure script check versions for Perl, Python, Tcl, etc.? If the version matters then conf

Re: [GENERAL] About PostgreSQL 8.0

2005-01-22 Thread Michael Fuhr
postgresql.org/docs/8.0/static/migration.html http://www.postgresql.org/docs/8.0/static/app-initdb.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] question about "delete performance"

2005-01-23 Thread Michael Fuhr
rformance in such situation. What does EXPLAIN ANALYZE DELETE ... show? Do you have an index on the oid column? Do you have foreign key constraints that need to be checked when rows are deleted? Do you have rules or triggers that are being invoked? -- Michael Fuhr http://www.fuhr.org/~mfu

Re: [GENERAL] querying two connections in one query

2005-01-24 Thread Michael Fuhr
re looking for. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] Ident authentication

2005-01-24 Thread Michael Fuhr
ing a TCP connection or a Unix-domain socket connection? If the former, do you have an IDENT server running? If the latter, what platform are you using? Not all operating systems can pass credentials over Unix-domain sockets. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ --

Re: [GENERAL] Ident authentication SOLVED

2005-01-24 Thread Michael Fuhr
On Mon, Jan 24, 2005 at 06:35:36PM +0200, Jarkko Elfving wrote: > I did get it work, thanks for help. What was the solution? It might be informative to people searching the list archives because they're having the same problem. -- Michael Fuhr http://www.fuhr.or

Re: [GENERAL] Ident authentication SOLVED

2005-01-24 Thread Michael Fuhr
On Mon, Jan 24, 2005 at 06:46:25PM +0200, Jarkko Elfving wrote: > On Mon, 2005-01-24 at 09:39 -0700, Michael Fuhr wrote: > > > > What was the solution? It might be informative to people searching > > the list archives because they're having the same problem. > &g

Re: [GENERAL] Search for restricting foreign keys

2005-01-24 Thread Michael Fuhr
that you could build queries to find out which rows in those tables match the given value. You could wrap all this code in a set-returning function. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] Validating user-input to be inserted in regular expressions

2005-01-25 Thread Michael Fuhr
would be easy to add such a function to PostgreSQL, so consider suggesting it to the developers or even writing it yourself and submitting a patch. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 9: the planner will ignore yo

Re: [GENERAL] Size of data stored in bytea record?

2005-01-25 Thread Michael Fuhr
and Operators" section of the "Functions and Operators" chapter in the documentation: http://www.postgresql.org/docs/8.0/static/functions-binarystring.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 2: you

Re: [GENERAL] Problem with Postgres V 8 and DBI maybe

2005-01-25 Thread Michael Fuhr
like this: my $dbh = DBI->connect($source, $user, $password, {RaiseError => 1}); my $sth = $dbh->prepare("INSERT INTO phonegroups VALUES (?, ?, ?)"); $sth->execute("TECHIES", 1, 1); $dbh->disconnect; -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [GENERAL] text field constraint advice

2005-01-25 Thread Michael Fuhr
ou might need to allow for greater variation. Use whatever makes sense for the type of data you're storing. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate

Re: [GENERAL] backslashes in queries containing LIKE

2005-01-26 Thread Michael Fuhr
n under "LIKE" discusses issues regarding the escape character (the backslash by default). -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] Size of data stored in bytea record?

2005-01-26 Thread Michael Fuhr
ght be closer to what you seek. http://www.postgresql.org/docs/8.0/static/functions-binarystring.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [GENERAL] text field constraint advice

2005-01-26 Thread Michael Fuhr
by misbehaving applications or by users who are bypassing the application (e.g., somebody tweaking the data from a psql session). Constraints in table definitions also serve as self-documentation. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(e

Re: [GENERAL] My postmaster just crashed !

2005-01-27 Thread Michael Fuhr
45353 in evaluate_expr (expr=0x8337ab8, result_type=1007) at clauses.c:2399 -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faq

Re: [GENERAL] View definition truncated in information_schema

2005-01-27 Thread Michael Fuhr
on_schema.views The above shows that the view_definition column gets its value from pg_get_viewdef(). What do the following queries return? SELECT length(pg_get_viewdef('viewname'::regclass)); SELECT pg_get_viewdef('viewname'::regclass); -- Michael F

Re: [BUGS] [GENERAL] My postmaster just crashed !

2005-01-27 Thread Michael Fuhr
On Thu, Jan 27, 2005 at 02:22:36PM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > On Thu, Jan 27, 2005 at 05:26:26PM +0100, PFC wrote: > >> It seems that contrib/intagg crashes my server : > > > I see the same thing with PostgreSQL 8.0.0 (RE

Re: [BUGS] [GENERAL] My postmaster just crashed !

2005-01-27 Thread Michael Fuhr
rintf("sizeof(long) = %d\n", sizeof(long)); return 0; } % gcc -m32 -o foo foo.c % ./foo sizeof(void *) = 4 sizeof(int)= 4 sizeof(long) = 4 % gcc -m64 -o foo foo.c % ./foo sizeof(void *) = 8 sizeof(int)= 4 sizeof(long) = 8 -- Michael Fuhr http://www.fuhr.org/~mfuhr

Re: [GENERAL] changing sort_mem on the fly?

2005-01-27 Thread Michael Fuhr
Does setting that variable per session actually have an effect, and if it does, does allowing ordinary users to set it present a risk? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ?

Re: [GENERAL] Problem with the copy command need help

2005-01-27 Thread Michael Fuhr
ing the COPY command is failing? It should print an error if it does, giving a hint at which line is causing a problem. What error, if any, are you seeing? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 7: don't forget

Re: [GENERAL] query variables

2005-01-27 Thread Michael Fuhr
78/VARIABLENAME as final_result; You could do it in a PL/pgSQL function or a function written in another procedural language. Another way would be to use a temporary table: CREATE TEMPORARY TABLE tmp AS SELECT count(*) AS foocount FROM foo; SELECT 56778 / (SELECT foocount FROM tmp) AS final_result; --

Re: [GENERAL] inet-type sequence

2005-01-29 Thread Michael Fuhr
K; INSERT INTO foo VALUES (DEFAULT); SELECT * FROM foo; addr - 192.168.1.1 192.168.1.2 192.168.1.3 192.168.1.5 (4 rows) -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [GENERAL] inet-type sequence

2005-01-29 Thread Michael Fuhr
On Sat, Jan 29, 2005 at 02:35:06PM -0700, Michael Fuhr wrote: > CREATE FUNCTION bigint2inet(bigint) RETURNS inet AS ' > BEGIN > RETURN cidr(''0x'' || lpad(to_hex($1), 8, ''0'')); > END; > ' LANGUAGE plpgsql IMMUTABLE STRICT;

Re: [GENERAL] postgresql 7.4.6 slowing down

2005-01-31 Thread Michael Fuhr
the "Run-time Configuration" section of the "Server Run-time Environment" chapter of the documentation: http://www.postgresql.org/docs/7.4/static/runtime-config.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)---

Re: [GENERAL] how to release a transaction lock on a table?

2005-01-31 Thread Michael Fuhr
ation should probably be fixed. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] table name restiction

2005-01-31 Thread Michael Fuhr
//www.postgresql.org/docs/8.0/static/sql-syntax.html#SQL-SYNTAX-IDENTIFIERS -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] how to release a transaction lock on a table?

2005-01-31 Thread Michael Fuhr
ent to understand what's happening before killing one transaction just so another can succeed. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

[GENERAL] cmin increments by 2 except in 7.4?

2005-01-31 Thread Michael Fuhr
2 | 2 856 |3 | 3 (3 rows) What is 7.4 doing differently than the other versions? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "

Re: [GENERAL] dumping and restoring user information.

2005-01-31 Thread Michael Fuhr
groups with "pg_dumpall --globals-only" (or -g). -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 6: Have you searched our list archives? http://archives.postgresql.org

Re: [GENERAL] how to release a transaction lock on a table?

2005-02-01 Thread Michael Fuhr
hat won't help you track down queries that are already running. Is it possible that the transaction holding the lock is idle? Some applications use long-lived transactions that can cause locking problems in other transactions. -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [GENERAL] how to release a transaction lock on a table?

2005-02-02 Thread Michael Fuhr
essExclusiveLock that ALTER TABLE wants. If that's the case, then maybe the application could be modified to COMMIT or ROLLBACK its transactions if it knows it's going to be idle for a while. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)-

Re: [GENERAL] Hiding databases

2005-02-03 Thread Michael Fuhr
On Thu, Feb 03, 2005 at 07:54:22PM +0100, Martin Balint wrote: > is it somehow possible to hide databases from users? To what end? Are you trying to keep users out of certain databases? If so, then you can configure pg_hba.conf accordingly. -- Michael Fuhr http://www.fuhr.org/~mf

Re: [GENERAL] Upgrade from 7.4 -> 8.0.1 - problem with dump/restore

2005-02-03 Thread Michael Fuhr
> significant amonuts of binary data stored in the dbms itself, and in > addition I have "tsearch" loaded. Are you using tsearch, or tsearch2? README.tsearch says that as of 7.4, tsearch is deprecated in favor of tsearch2. Did you install the 8.0.1 version of whatever mo

Re: [GENERAL] Problem resolved (tsearch2 inhibiting migration)

2005-02-03 Thread Michael Fuhr
you to figure out the DROP statements yourself? Running "gmake uninstall" in the module's source directory only removes the .so, .sql, and other installed files -- it doesn't DROP any objects that have been created in databases. -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [GENERAL] Questions about functionality

2005-02-04 Thread Michael Fuhr
e contrib/dblink module. You can also write set-returning functions in procedural languages like PL/Perl, PL/Tcl, and PL/Python, so you can exploit any database-querying capabilities those languages provide. David Fetter's DBI-Link module does this, for example. I've written my own fu

Re: [GENERAL] PostgreSQL, exception and PHP

2005-02-07 Thread Michael Fuhr
leading "ERROR: " but that's easy. If that doesn't answer your question, then please show what you're doing, exactly what results you're getting, and exactly what results you'd like to get. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ --

Re: [GENERAL] a SELECT FOR UPDATE question

2005-02-07 Thread Michael Fuhr
ed. (This sounds familiar, like I've participated in a thread on this topic before. I get the feeling Tom Lane is going to step in and provide The Real Answer, and that my radio is about to start playing "I Got You, Babe") -- Michael Fuhr http://www.fuhr.org/~mfuhr/

Re: [GENERAL] a SELECT FOR UPDATE question

2005-02-07 Thread Michael Fuhr
On Tue, Feb 08, 2005 at 12:58:34AM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > > > I think you can infer that a process is working with a row in some > > manner (UPDATE, SELECT FOR UPDATE) by looking at the row's xmax > > colu

Re: [GENERAL] create temp table and on commit in 7.3.3

2005-02-08 Thread Michael Fuhr
cs/7.3/static/sql-createtable.html#SQL-CREATETABLE-COMPATIBILITY http://www.postgresql.org/docs/7.2/static/sql-createtable.html#SQL-CREATETABLE-COMPATIBILITY Should those versions describe ON COMMIT if they don't support it? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---

Re: [GENERAL] create temp table and on commit in 7.3.3

2005-02-09 Thread Michael Fuhr
On Wed, Feb 09, 2005 at 03:40:49PM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > The 7.3 and 7.2 documentation for CREATE TABLE both mention ON COMMIT: > > > http://www.postgresql.org/docs/7.3/static/sql-createtable.html#SQL-CREATETABL

Re: [GENERAL] Understanding EXPLAIN ANALYZE output

2005-02-09 Thread Michael Fuhr
thing simple in a higher-level PL. As for the return type, I was going to look at explain_outNode() in src/backend/commands/explain.c and get some ideas from there. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [GENERAL] a SELECT FOR UPDATE question

2005-02-09 Thread Michael Fuhr
On Tue, Feb 08, 2005 at 01:45:44AM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > On Tue, Feb 08, 2005 at 12:58:34AM -0500, Tom Lane wrote: > >> I'm too tired to work out an example, but I think this probably doesn't > >> work in

Re: [GENERAL] Understanding EXPLAIN ANALYZE output

2005-02-09 Thread Michael Fuhr
On Wed, Feb 09, 2005 at 11:36:22PM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > I started looking at this earlier. Is it even possible to get > > EXPLAIN output via SPI (and thus the PLs' interfaces to SPI)? > > Hmm ... my first reaction

Re: [GENERAL] pg_affected Change Request

2005-02-09 Thread Michael Fuhr
nged (whether updated, inserted or deleted). Please provide an example of what you're doing, what results you expect or would like to see, and what results you actually get. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [GENERAL] Any functions to convert bit(5) to text?

2005-02-09 Thread Michael Fuhr
current implementations of PL/pgSQL you can do this: CREATE FUNCTION bit2text(bit) RETURNS text AS ' BEGIN RETURN $1; END; ' LANGUAGE plpgsql IMMUTABLE STRICT; See also CREATE CAST. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--

Re: [GENERAL] Any functions to convert bit(5) to text?

2005-02-09 Thread Michael Fuhr
On Thu, Feb 10, 2005 at 12:00:31AM -0700, Michael Fuhr wrote: > > CREATE FUNCTION bit2text(bit) RETURNS text AS ' > BEGIN > RETURN $1; > END; > ' LANGUAGE plpgsql IMMUTABLE STRICT; This also appears to work: CREATE TABLE foo (b varbit); INSERT INTO foo VAL

Re: [GENERAL] Any functions to convert bit(5) to text?

2005-02-09 Thread Michael Fuhr
On Thu, Feb 10, 2005 at 12:16:53AM -0700, Michael Fuhr wrote: > > SELECT textin(bit_out(b)) FROM foo; Is it generally true that you can convert between types using the above method, assuming compatible syntax? That is, using the source type's output function to get a cstring that you

Re: [GENERAL] a SELECT FOR UPDATE question

2005-02-10 Thread Michael Fuhr
ED then the tests I've done so far have always seen xmax change to whoever currently holds the lock. There's still a race condition, but visibility doesn't seem to be a problem. Is that not supposed to be happening, or am I still missing something? -- Michael Fuhr http://www.fuhr.

Re: [GENERAL] Understanding EXPLAIN ANALYZE output

2005-02-10 Thread Michael Fuhr
On Thu, Feb 10, 2005 at 08:04:52AM -0700, Ed L. wrote: > On Wednesday February 9 2005 10:10, Michael Fuhr wrote: > > > > Any suggestions for the meantime? > > Well, this would be a bit unsightly and not exactly elegant, but > I'd think you could do this via DB

Re: [GENERAL] Python Interface

2005-02-10 Thread Michael Fuhr
psycopg is popular. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] no self-joins in views?

2005-02-10 Thread Michael Fuhr
> code clean. However, I get an error 'column xy duplicated'. Is this > so by design? Use column aliases so the xy columns don't have the same name: CREATE VIEW viewname AS SELECT a.xy AS axy, b.xy AS bxy FROM foo AS a, foo AS b WHERE ... -- Michae

Re: [GENERAL] pg_affected Change Request

2005-02-10 Thread Michael Fuhr
ND (col1 IS DISTINCT FROM OR col2 IS DISTINCT FROM ...) This statement uses IS DISTINCT FROM instead of <> so the comparisons will handle NULLs properly. If the columns are all NOT NULL then you could use <>. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] Python Interface

2005-02-10 Thread Michael Fuhr
displaying times as HH:MM:SS.ss, but the extra precision does appear to be there: In psql: SELECT tm FROM foo; tm - 14:32:41.219443 In Python: curs.execute('SELECT tm FROM foo') row = curs.dictfetchone() print row['tm'] 14:32:41.21 print row

Re: [GENERAL] Functions with more than 32 parameters

2005-02-10 Thread Michael Fuhr
type and use a row constructor when you call it. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [GENERAL] Catching delete

2005-02-10 Thread Michael Fuhr
cribes how a trigger can affect the attempted operation: http://www.postgresql.org/docs/8.0/static/triggers.html http://www.postgresql.org/docs/8.0/static/plpgsql-trigger.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--

Re: [GENERAL] Understanding EXPLAIN ANALYZE output

2005-02-10 Thread Michael Fuhr
On Thu, Feb 10, 2005 at 03:38:05PM -0500, Tom Lane wrote: > Michael Fuhr <[EMAIL PROTECTED]> writes: > > > Any suggestions for the meantime? > > Update to CVS tip ;-) Done. Below is a simple proof of concept for an explain() function in PL/pgSQL. It's not necessa

Re: [GENERAL] Understanding EXPLAIN ANALYZE output

2005-02-10 Thread Michael Fuhr
On Thu, Feb 10, 2005 at 03:48:48PM -0700, Michael Fuhr wrote: > > Below is a simple proof of concept for an explain() function > in PL/pgSQL. Do PL/Perl and the other PLs require any changes to make this work? I tried $rv = spi_exec_query("EXPLAIN $query") but $rv contained

Re: [GENERAL] Understanding EXPLAIN ANALYZE output

2005-02-10 Thread Michael Fuhr
ty is a problem though... What about making both ways work? EXPLAIN would format the output the way it currently looks, and SELECT * FROM explain(...) would return a resultset. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 3: if

Re: [GENERAL] a SELECT FOR UPDATE question

2005-02-10 Thread Michael Fuhr
bout might hold a lock." Does that about sum it up? ;-) -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])

Re: [GENERAL] size in bytes of a table?

2005-02-11 Thread Michael Fuhr
16 Kb,62018 rows) Take a look at contrib/dbsize and contrib/pgstattuple. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Michael Fuhr
THEN -- do integer stuff ELSIF coltype(param) = 'boolean'::regtype THEN -- do boolean stuff END IF; -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Michael Fuhr
OM foo; idtype | foodatetype -+- integer | date SELECT argtype(x) FROM (SELECT foodate FROM foo) AS s(x); argtype - date -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [GENERAL] Python Driver

2005-02-11 Thread Michael Fuhr
script itself is locked up, or just that locks in the database are causing certain transactions to block? Have you looked at pg_locks? Are locks being held by idle uncommitted transactions? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)

Re: [GENERAL] Python Driver

2005-02-11 Thread Michael Fuhr
With this configuration you'll be able to see what each connection is doing. -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail c

Re: [GENERAL] Python Driver

2005-02-11 Thread Michael Fuhr
): http://www.postgresql.org/docs/8.0/static/catalogs.html "relation" refers to an oid in pg_class. An easy way to convert it to a relation name is to cast it to regclass: SELECT relation::regclass, * FROM pg_locks; -- Michael Fuhr http://www.fuhr.org/~mfuhr/ -

Re: [GENERAL] 8.0 Beta3 worked, RC1 didn't!

2004-12-21 Thread Michael Fuhr
en when root.crt exists) until a couple of months ago. Was that change intentional or accidental? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [GENERAL] test datatype for ANY

2005-02-11 Thread Michael Fuhr
your example, you get a separate version for integer, numeric, etc. Is that the general case for polymorphic functions? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings

Re: [GENERAL] pg_affected Change Request

2005-02-14 Thread Michael Fuhr
before the execution of S. If that's an appropriate reference and if I'm reading it correctly, then PostgreSQL's behavior appears to comply with the standard. Maybe one of the developers can confirm or deny. [1] http://www.wiscorp.com/sql/sql_2003_standard.zip -- M

Re: [GENERAL] More info about PostgreSQL 8

2005-02-14 Thread Michael Fuhr
lback-to.html http://www.postgresql.org/docs/8.0/static/backup.html http://www.postgresql.org/docs/8.0/static/backup-online.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http:/

Re: [GENERAL] Privileges question

2005-02-14 Thread Michael Fuhr
postgresql.org/docs/8.0/static/ddl-schemas.html#DDL-SCHEMAS-PRIV http://www.postgresql.org/docs/8.0/static/sql-grant.html -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [GENERAL] pg_affected Change Request

2005-02-14 Thread Michael Fuhr
On Thu, Feb 10, 2005 at 10:31:40AM -0700, Michael Fuhr wrote: > > UPDATE tablename SET col1 = , col2 = , ... > WHERE keycol = > AND (col1 IS DISTINCT FROM OR >col2 IS DISTINCT FROM ...) You could also do this with a trigger. If all columns in the old and new row

Re: [GENERAL] random record from small set

2005-02-14 Thread Michael Fuhr
Y i ORDER by i; i | count ---+--- 1 | 2501 2 | 2040 3 | 1463 4 | 994 5 | 3002 (5 rows) Time: 8765.584 ms I ran each query several times and those times were typical of both. With a data set of 100 records, the PL/pgSQL function ran in about 14 seconds, while the

Re: [GENERAL] CURSORs and selects with parameters

2005-02-15 Thread Michael Fuhr
FETCH I'm getting back the error: > >ERROR: no value found for parameter 1 What version of PostgreSQL are you using? I think this is fixed in 8.0. http://archives.postgresql.org/pgsql-general/2005-01/msg00812.php -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---

[GENERAL] Need to check palloc() return value?

2005-02-15 Thread Michael Fuhr
fluous. Is it safe to rely on this behavior? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8: explain analyze is your friend

<    4   5   6   7   8   9   10   11   12   13   >