Re: [HACKERS] [PATCHES] ALTER TABLE ... SET TABLESPACE

2004-06-21 Thread Gavin Sherry
I'm rewriting the patch so don't worry :-)

Thanks,

Gavin

On Mon, 21 Jun 2004, Mark Kirkwood wrote:

 I don't know if this provides any more info than you already have -
 but is my last few lines from a single process backend run with valgrind :

 ==19666== Syscall param write(buf) contains uninitialised or
 unaddressable byte(s)
 ==19666==at 0x404D94F8: __GI___libc_write (in /lib/libc-2.3.2.so)
 ==19666==by 0x80934F8: XLogFlush (xlog.c:1414)
 ==19666==by 0x8090723: RecordTransactionCommit (xact.c:550)
 ==19666==by 0x8090BC0: CommitTransaction (xact.c:931)
 ==19666==Address 0x4219236A is not stack'd, malloc'd or free'd
 backend 1: oid (typeid = 26, len = 4, typmod = -1, byval = t)
  2: nspname (typeid = 19, len = 64, typmod = -1, byval = f)
  3: relname (typeid = 19, len = 64, typmod = -1, byval = f)
 
 ==19666==
 ==19666== Invalid write of size 4
 ==19666==at 0x8109B00: DLMoveToFront (dllist.c:237)
 ==19666==by 0x81B2EB5: SearchCatCache (catcache.c:1155)
 ==19666==by 0x81B7D72: GetSysCacheOid (syscache.c:606)
 ==19666==by 0x81B8C7A: get_relname_relid (lsyscache.c:879)
 ==19666==Address 0xCC3D5C04 is not stack'd, malloc'd or free'd
 Segmentation fault


 Gavin Sherry wrote:

 On Sun, 20 Jun 2004, Tatsuo Ishii wrote:
 
 
 
 Attached is a patch implementing this functionality.
 
 I've modified make_new_heap() as well as swap_relfilenodes() to not assume
 that tablespaces remain the same from old to new heap. I thought it better
 to go down this road than introduce a lot of duplicate code.
 
 
 I have tried your patches and it works great. Thanks.
 
 One thing I noticed was if I change tablespace for a table having
 indexes, they are left in the old tablespace and the table itself was
 moved to the new tablespace. I regard this is a good thing since I
 could assign different table spaces for table and indexes.
 It would be even better to assign different tablespaces for each
 index.
 
 
 Hm. It seems there's a problem with tablespaces. What I did was:
 
 pgbench -i test
 alter table accounts set tablespace mydb2;
 \d accounts
 
 backend crashes by signal 11...
 
 
 
 
 


 !DSPAM:40d66cf4282571539216297!



---(end of broadcast)---
TIP 8: explain analyze is your friend


[HACKERS] email browser?

2004-06-21 Thread Santo Quartarone
What's the safest email browser?




---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [HACKERS] [PATCHES] ALTER TABLE ... SET TABLESPACE

2004-06-21 Thread Mark Kirkwood
I don't know if this provides any more info than you already have -
but is my last few lines from a single process backend run with valgrind :
==19666== Syscall param write(buf) contains uninitialised or 
unaddressable byte(s)
==19666==at 0x404D94F8: __GI___libc_write (in /lib/libc-2.3.2.so)
==19666==by 0x80934F8: XLogFlush (xlog.c:1414)
==19666==by 0x8090723: RecordTransactionCommit (xact.c:550)
==19666==by 0x8090BC0: CommitTransaction (xact.c:931)
==19666==Address 0x4219236A is not stack'd, malloc'd or free'd
backend 1: oid (typeid = 26, len = 4, typmod = -1, byval = t)
2: nspname (typeid = 19, len = 64, typmod = -1, byval = f)
3: relname (typeid = 19, len = 64, typmod = -1, byval = f)
   
==19666==
==19666== Invalid write of size 4
==19666==at 0x8109B00: DLMoveToFront (dllist.c:237)
==19666==by 0x81B2EB5: SearchCatCache (catcache.c:1155)
==19666==by 0x81B7D72: GetSysCacheOid (syscache.c:606)
==19666==by 0x81B8C7A: get_relname_relid (lsyscache.c:879)
==19666==Address 0xCC3D5C04 is not stack'd, malloc'd or free'd
Segmentation fault

Gavin Sherry wrote:
On Sun, 20 Jun 2004, Tatsuo Ishii wrote:
 

Attached is a patch implementing this functionality.
I've modified make_new_heap() as well as swap_relfilenodes() to not assume
that tablespaces remain the same from old to new heap. I thought it better
to go down this road than introduce a lot of duplicate code.
   

I have tried your patches and it works great. Thanks.
One thing I noticed was if I change tablespace for a table having
indexes, they are left in the old tablespace and the table itself was
moved to the new tablespace. I regard this is a good thing since I
could assign different table spaces for table and indexes.
It would be even better to assign different tablespaces for each
index.
 

Hm. It seems there's a problem with tablespaces. What I did was:
pgbench -i test
alter table accounts set tablespace mydb2;
\d accounts
backend crashes by signal 11...
   

 

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [HACKERS] email browser?

2004-06-21 Thread John Hansen
On Fri, 2004-06-18 at 22:47, Santo Quartarone wrote:
 What's the safest email browser?
 
 

telnet mailserver.domain.tld 110

 
 
 ---(end of broadcast)---
 TIP 3: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly

... John


---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[HACKERS] Stuff I'm working on

2004-06-21 Thread Christopher Kings-Lynne
Hi,
Since I'm waiting for someone to comment on my last question about dump 
ordering for grant and owner statements, what I think I'll do is submit 
a patch first (to get in before feature freeze) that adds all the OWNER 
TO commands, docs and regression tests.  It will also do RENAME and 
OWNER on tablespaces.

Then, if I have time I'll fix grant dump ordering for june 30, otherwise 
it _may_ have to wait for the beta period.

Since you can consider the current state of pg_dump to be buggy, is it 
ok to fix it after feature freeze?

Also, I'd love to get pg_dumpall binary format dumping in by feature 
freeze, but I don't know if I'll make it.  I guess that's more of a 
feature than a bug though.

I got the pg_get_serial_sequence function in early so that no initdb 
would be needed during beta...

Chris
ps. Please someone comment on my last question about pg_dump grant 
ordering!  Thanks!

---(end of broadcast)---
TIP 7: don't forget to increase your free space map settings


[HACKERS] placeholder syntax

2004-06-21 Thread Abhijit Menon-Sen
PostgreSQL currently uses $1/$2 for placeholders in prepared statements.
I'm writing something that may potentially submit queries to both Oracle
and Postgres, and it seems Oracle doesn't accept this syntax. Someone on
IRC said I could use ? for both Oracle and Postgres. It isn't entirely
clear to me if Oracle accepts it, but Postgres doesn't seem to.

My copy of the SQL92 standard says:

«In SQL-statements that are executed dynamically, the parameters are
called dynamic parameters (dynamic parameter specifications) and
are represented in SQL language by a question mark (?).»

(There's also an embedded variable name production in the standard,
which looks like the :foo syntax that Oracle also accepts, but I'm not
sure it applies to placeholders. The standard is a bit hard to read.)

Should Postgres accept ? as a placeholder?

(If so, I'll dig around and try to figure out how to make it do so.)

-- ams

---(end of broadcast)---
TIP 8: explain analyze is your friend


Re: [HACKERS] placeholder syntax

2004-06-21 Thread Tom Lane
Abhijit Menon-Sen [EMAIL PROTECTED] writes:
 Should Postgres accept ? as a placeholder?

We think it's an operator character:

regression=# select 1 ? 4;
ERROR:  operator does not exist: integer ? integer

I count eighteen standard operators that would be broken if we changed
'?' to mean a parameter.

I am also pretty unclear on why '?' is a good notation for parameters,
seeing that it is very hard for either the user or the machine to tell
which is which when there are multiple parameters.

In short, I think this notation sucks and I don't want to emulate it.

We do have the :foo notation in ecpg, which may be your closest parallel
for handling Oracle-workalike code anyway.

regards, tom lane

---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [HACKERS] Compile failure with SSL

2004-06-21 Thread Merlin Moncure
Dave Page wrote:
 OK, looks like the error below is a Win32 thing. The patch attached
 #ifdef'd out the permissions check on the private key file as it won't
 work under Windows anyway (a similar check in postmaster.c has has
 already been ifdef'd out for the same reason).
 
 Incidently, the consts are also used in initdb.c where they work just
 fine - can't seem to figure out where it gets them from though (must
be
 missing something). Normally they're in sys/stat.h, but not in mingw
 (where they can only be found in glibc/sys/stat.h). Magnus also
 mentioned to me that Merlin's snapshots are building fine without this
 patch - dunno if he has a different version of sys/stat.h...
 
 Anyway, regardless of that I think the patch is relevant.

I had made the same changes as you to be_secure...(actually, I recently
stopped doing that, I need to update the snapshot info page).  The real
problem is that the SSL based connection does not receive signals while
waiting on select() like the regular connection does.  IMO, the SSL
patch should not be applied until this has been resolved.

Merlin


---(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: [HACKERS] placeholder syntax

2004-06-21 Thread Greg Stark

Tom Lane [EMAIL PROTECTED] writes:

 Abhijit Menon-Sen [EMAIL PROTECTED] writes:
  Should Postgres accept ? as a placeholder?
 
 In short, I think this notation sucks and I don't want to emulate it.

Certainly it sucks. Unfortunately it's the supported ODBC API which is
emulated by everyone else, including JDBC and DBI. So the world's pretty much
stuck with it.

However this isn't Postgres's problem. If you want to write code that works
with multiple databases then you're going to want to be using something like
ODBC or JDBC or DBI anyways. In which case it's the driver's responsibility to
provide the standard API which includes translating ? into appropriate syntax
for the database.

In other words, your problem should already be solved by your driver.

-- 
greg


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [HACKERS] placeholder syntax

2004-06-21 Thread Mike Mascari
Greg Stark wrote:
Tom Lane [EMAIL PROTECTED] writes:
Abhijit Menon-Sen [EMAIL PROTECTED] writes:
Should Postgres accept ? as a placeholder?
In short, I think this notation sucks and I don't want to emulate it.
Certainly it sucks. Unfortunately it's the supported ODBC API which is
emulated by everyone else, including JDBC and DBI. So the world's pretty much
stuck with it.
However this isn't Postgres's problem. If you want to write code that works
with multiple databases then you're going to want to be using something like
ODBC or JDBC or DBI anyways. In which case it's the driver's responsibility to
provide the standard API which includes translating ? into appropriate syntax
for the database.
This brings back memories. This is how the whole Access hack for the 
parse-time transformation of '= NULL' to 'IS NULL' came about. IIRC, 
older versions of Access would invoke SQLPrepare() with a statement 
like:

SELECT *
FROM employees
WHERE employeeid = ?
then invoke SQLBindParameter() with NULL as the value, followed by 
SQLExecute() and the backend would receive:

SELECT *
FROM employees
WHERE employeeid = NULL
Later versions of one of the Access components (jet, mdac, 
access.exe - who knows where) changed its behavior and never 
performed similarly...

Mike Mascari


---(end of broadcast)---
TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]


Re: [HACKERS] placeholder syntax

2004-06-21 Thread Thomas Hallgren
Personally, I agree. The '?' sucks for multiple reasons. The major reason
being when you want to use the same parameter in more than one place in a
statement. Another reason is query rewrites where you have to reorganize the
actual order of parameters. You are then forced to first convert the '?'
into some other form (like the $1, $2 syntax that PostgreSQL uses today).

But even if it sucks, it's used by a very broad range of clients. As Greg
mentions, both ODBC and JDBC uses this syntax and no other SQL database that
I know of treats '?' as an operator. The '?' is, and will remain, a
parameter placeholder in SQL for most people. So even if '?' shouldn't be
emulated at this time, perhaps it would be a good idea to abandon it as a
valid operator?

Kind regards,

Thomas Hallgren

Greg Stark [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]

 Tom Lane [EMAIL PROTECTED] writes:

  Abhijit Menon-Sen [EMAIL PROTECTED] writes:
   Should Postgres accept ? as a placeholder?
 
  In short, I think this notation sucks and I don't want to emulate it.

 Certainly it sucks. Unfortunately it's the supported ODBC API which is
 emulated by everyone else, including JDBC and DBI. So the world's pretty
much
 stuck with it.

 However this isn't Postgres's problem. If you want to write code that
works
 with multiple databases then you're going to want to be using something
like
 ODBC or JDBC or DBI anyways. In which case it's the driver's
responsibility to
 provide the standard API which includes translating ? into appropriate
syntax
 for the database.

 In other words, your problem should already be solved by your driver.

 -- 
 greg


 ---(end of broadcast)---
 TIP 2: you can get off all lists at once with the unregister command
 (send unregister YourEmailAddressHere to [EMAIL PROTECTED])



---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


[HACKERS] creating a cluster

2004-06-21 Thread Alexander Cohen
Does anyone have any new ways to create clusters without using initdb 
or bootstrap mode? I need to be able to create one without those 2 
things. Any ideas?

thanks!
Alex
---(end of broadcast)---
TIP 3: if posting/reading through Usenet, please send an appropriate
 subscribe-nomail command to [EMAIL PROTECTED] so that your
 message can get through to the mailing list cleanly


Re: [HACKERS] creating a cluster

2004-06-21 Thread Alvaro Herrera
On Mon, Jun 21, 2004 at 09:16:35PM -0400, Alexander Cohen wrote:
 Does anyone have any new ways to create clusters without using initdb 
 or bootstrap mode? I need to be able to create one without those 2 
 things. Any ideas?

initdb'ing somewhere else and copying the resulting directory?

-- 
Alvaro Herrera (alvherre[a]dcc.uchile.cl)
Find a bug in a program, and fix it, and the program will work today.
Show the program how to find and fix a bug, and the program
will work forever (Oliver Silfridge)


---(end of broadcast)---
TIP 2: you can get off all lists at once with the unregister command
(send unregister YourEmailAddressHere to [EMAIL PROTECTED])


Re: [HACKERS] creating a cluster

2004-06-21 Thread Tom Lane
Alexander Cohen [EMAIL PROTECTED] writes:
 Does anyone have any new ways to create clusters without using initdb 
 or bootstrap mode? I need to be able to create one without those 2 
 things. Any ideas?

Perhaps you should explain *why* you think you need this?

regards, tom lane

---(end of broadcast)---
TIP 5: Have you checked our extensive FAQ?

   http://www.postgresql.org/docs/faqs/FAQ.html