PostgreSQL 8.0 Enters Beta 368
gavinroy writes "As announced in pgsql-announce, PostgreSQL 8.0 Beta is now available. New features include native win32 support, Point in Time Recovery, Tablespaces, and much more! here is the beta history if you want more information."
You can save a few clicks... (Score:5, Informative)
Re:You can save a few clicks...and read it here. (Score:3, Informative)
From: "Marc G. Fournier"
To: pgsql-announce ( at ) postgresql ( dot ) org
Subject: PostgreSQL 8.0.0 Officially Goes Beta
Date: Mon, 9 Aug 2004 21:36:52 -0300 (ADT)
After almost 9 months of development, the PostgreSQL Global Development Group is proud to announce that development on PostgreSQL 8.0.0 has now finished, and is ready for some serious testing.
For those wondering about the 8.0.0 designation on this release, there have been several *very* large features included i
Thank you Fujitsu And Afilias. (Score:5, Interesting)
I just wanted to say thanks to Fujitsu for helping pay for this [newsforge.com]
And thanks to Afilias (the guys who run theRe:Thank you Fujitsu And Afilias. (Score:3, Interesting)
Re:Thank you Fujitsu And Afilias. (Score:3, Insightful)
Re:Thank you Fujitsu And Afilias. (Score:4, Interesting)
Strongly disagree.
The PostgreSQL website is easy to navigate and easy on the eyes. Links to anything most users will need -- downloads, docs, and search -- are right at the top of every page.
The MySQL website uses microfonts, and good luck finding documentation without resorting to google site:mysql.com; there's links to it on some pages and not others, and most notably not on the front page. The MySQL website is, apparently, trying to be oracle.com, only worse.
The difference is pretty simple: The postgresql developers are trying to write a database server. Selling it is not their concern, nor is marketing it to the world: they let others (mostly, their users) do that while they focus on development. MySQL, on the other hand, is a business: they need customers to survive, and sometimes the technology takes a back seat to the business side of things.
Re:Thank you Fujitsu And Afilias. (Score:4, Interesting)
What's slightly noteworthy about Slony is that it has "switchover" support. If the master fails, one of the slaves become the master.
Of course, since Slony's replication is asynchronous, it means that at the point of switchover, slaves might not have received all pending changes, thus becoming out of sync with the master. Unfortunately, Slony doesn't really address this problem.
The design overview [postgresql.org] is useful reading, if rather confusing; the writer's first language is probably not English.
Re:Thank you Fujitsu And Afilias. (Score:3, Interesting)
Calm down. Breathe.
Re:You can save a few clicks... (Score:3, Informative)
The concurrent versioning system means some operations are inherently fairly slow (like updates), but it also allows very limited locking and writers don't prohibit readers from viewing data, which in a multi-user environment is very nice.
Most slowness users experience when starting with PostgreSQL is due to them being used to MySQL and not understanding how to do things in a f
where to download (Score:5, Informative)
the windows installer is at
http://pgfoundry.org/projects/pginstaller
Bittorrent [was Re:where to download] (Score:4, Informative)
Join the torrent!
BitTorrent Downloads (Score:5, Informative)
I recommend Mysql users to take a look at PG (Score:4, Insightful)
Re:I recommend Mysql users to take a look at PG (Score:2, Interesting)
Re:I recommend Mysql users to take a look at PG (Score:5, Informative)
While it is true that the PostgreSQL project doesn't include full text searching there is a full text searching engine for PostgreSQL. The "problem" is that it is licensed under the GPL, not a BSD-style license, and so it is not included in the official distribution. Here's [sourceforge.net] the link.
OpenFTS has been around for quite a while, and is used pretty heavily, so there really is very little reason to put up with MySQL's many shortcomings.
Re:I recommend Mysql users to take a look at PG (Score:4, Informative)
The documentation [sai.msu.su] describes the differences between tsearch2 and openfts like this:
full text search (Score:5, Informative)
Re:I recommend Mysql users to take a look at PG (Score:3, Informative)
pg_dump --format=c
peace
Re:I recommend Mysql users to take a look at PG (Score:3, Interesting)
Re:I recommend Mysql users to take a look at PG (Score:5, Informative)
Replication (master & multiple slaves) works great with Slony [postgresql.org].
Fail over should not be done by the database, but by the operating system or an external monitoring system (Big Brother). RedHat Enterprise with the standard failover configuration works fine.
You just need to tell Slony that the new node has been elected as master. It's not as clean as it could be (no gui tools, etc.) but it is functional enough for the
Re:I recommend Mysql users to take a look at PG (Score:3, Interesting)
Now that PostgresQL has got good Open Source replication available, I expect to see a lot more people migrate to PostgreSQL. I'll be testing out PostgreSQL + Slony shortly.
Re:I recommend Mysql users to take a look at PG (Score:2)
replication is not a failover solution (Score:5, Interesting)
Re:replication is not a failover solution (Score:5, Informative)
The true failover functionality you are talking about will be the goal of my follow-up project Slony-II, which will implement synchronous multi master replication for PostgreSQL. The design phase will start in about 3-5 months.
Sincely, Jan
Re:replication is not a failover solution (Score:3, Informative)
Re:I recommend Mysql users to take a look at PG (Score:5, Interesting)
Stored Procedures. They arent functions. Functions are different. Functions should be called inline, from within SQL statements. There should be a difference.
When looking towards migrating to an OSS database from MS SQL Server I looked into how easy it was to use the postgres stored procedure/functions/things. I couldn't find any equivalent of returing a resultset. In MS SQL you use:
The only way that I could find to do that in postgres was:
So it seems that we're stuck with MS SQL server.
If someone DOES know how to do this is a non-evil manner, please tell me! Were planning on doing an upgrade, and I'd rather not have to fork out the money for SQL Server licences etc...
Re:I recommend Mysql users to take a look at PG (Score:2)
For that you don't need a procedure, you need a view.
Re:I recommend Mysql users to take a look at PG (Score:5, Informative)
Using postgresql 7.4.2:
That will print all the company names in my database.
Re:I recommend Mysql users to take a look at PG (Score:4, Informative)
And yes, I could add arguments to that:
Obviously this is a simplified example, but you get the idea. And I assume that this capability extends to other embedded language like perl or ruby.
Re:I recommend Mysql users to take a look at PG (Score:3, Informative)
Re:I recommend Mysql users to take a look at PG (Score:3, Interesting)
Heh... you're kidding, right?
There are enough MySQL gotchas [sql-info.de] to drive anyone used to Oracle up the psych ward walls.
Every web developer I know keeps raving about the speed of MySQL... when I show them my database schema, it's usually the first time they've seen a 58 table database. It seems huge and unmanageable if you're used to 1-5 tables, and it most certainly isn't easy without triggers, stored procedures and foreign keys or any of the more complex functions and que
More adoption of SQL92 than of MySQL's QL (Score:3, Insightful)
Die IT theme (Score:4, Funny)
What the versions mean (Score:2)
Yes (Score:2)
Re:What the versions mean (Score:5, Informative)
In the case of postgres there are three digits in the version - a.b.c
If your upgrade increases either a or b then the on-disk structure of the database has changed, and as part of the upgrade you'll need to dump the database out to a backup file and restore it.
If the only change is in the final digit c then there's no on-disk change and you can upgrade just by upgrading the binaries. That tends to mean that final digit upgrades are bug fixes, and you should always do the upgrade.
So if you're running 7.4.1 you can easily, and definitely should, upgrade to 7.4.3. But upgrading to 8.0 is a marginally more time-consuming upgrade that you may not want to make on a production system unless you want the new features in 8.0
There's no 'technical' difference between a first digit change upgrade and a second digit upgrade. There's a difference in expectations though, and the version following 7.4.* has enough major new features to justify a major version jump to 8.0.0, with all the positives and negatives that jump implies. The upgrade path would have been identical had it been called 7.5.0 though.
Re:What the versions mean (Score:2)
Re:What the versions mean (Score:3, Informative)
As I understood from reading the lists, there is a technical distinction. a.(b+1).c is supposed to be more stable than a.b.d, even though it may have some additional features.
8.0 added so many powerful features that the developers did not want to imply that it would be more stable than 7.4. 7.4 is pretty much rock-solid, and 8.0 might not achieve that reputation until 8.1 or so.
Can it Compete with Oracle or DB2? (Score:5, Interesting)
On the other hand, I've seen both Oracle and DB2 corrupt indexes and database table data in various circumstances (Usually the failing of a DBA in some capacity or other.) I'd be curious to see how the various databases stack up against each other without the hype that most of the parties that publish such studies usually bring to the table.
Re:Can it Compete with Oracle or DB2? (Score:5, Informative)
With 50 to 100 users, both have similar performance for many workloads (you need to test your specific workload), but Pg may require a touch more tuning.
Pg is, however, quite a bit more reliable than Oracle as far as corruptions go (keeping in mind this is a
There are ways of purposfully crashing PostgreSQL as an authenticated user (particularly if you have root access and can write functions in C), but in standard operation it's quite reliable.
I cannot speak for DB2, but based on their Docs I think Pg is nearly as feature complete in most areas, and much more complete in many others.
PG requires more tuning than Oracle? (Score:2)
(From someone who used to wear Oracle DBA as one of his hats.)
Re:PG requires more tuning than Oracle? (Score:2)
Of course, those situations often result in planner or optimizer patches and the next version doing better for everyone
Re:Can it Compete with Oracle or DB2? (Score:5, Insightful)
In 8 years i've never lost data from an Oracle database from a software problem. I've seen data get lost, corrupted for a number of reasons including incompetent DBA's and their managers. (Off topic but once I was called into a major telephone company because they had some corrupted blocks from a hardware issue. I asked them how long did they keep their backups, 3 months they replied. Ok, how long have you known about this problem, 5 months. Hrmm... 3 - 5 = -2. You can fill in the rest of the story..)
I haven't used postgreSQL in a production environment long enough to know how stable it is. The reason companies choose commercial vendors for their DB's are two fold:
1) Track record. They know if they pick Oracle or DB2 they are getting a solid,proven database system. And there is an abundance (if not expensive) of knowledge out there. Their support is bar none and for the most part I have been extremely satisfied.
2) Managemnt loves to save money. Who wouldn't want to be able to say they saved the company millions of dollars by going to a 'free' or inexpensive (if you pay for support) rdbms like postgresql or mysql. One reason, blame. Opensource still has the stigma attached to it that no one is accountable for bugs. If a critical revenue generating db goes down because of a bug a manager needs to be able to point their finger. Until this stigma goes away we won't see alot of opensource adoption in the DB market. Whether this is right or wrong doesn't matter, people don't like change and opensource is a huge change for alot of managers.
Re:Can it Compete with Oracle or DB2? (Score:4, Informative)
Here's the ISOC's response to Oracle FUD. [icann.org]
Re:Can it Compete with Oracle or DB2? (Score:2)
Oh, and a link to Oracle's FUD [icann.org] when they were trying to keep control of the .org comain:
"PostgreSQL is used primarily
in the embedded system market because it lacks the transactional
features, high availability, security and manageability of any
commercial enterpr
Re:Can it Compete with Oracle or DB2? (Score:5, Informative)
There is alot of hype in the database market as is there with any other area such as OS preference. A good DBA, like a good software developer will pick the database that fits the needs. Saying that, usually DBA's (like anyone else) are under certain constraints from management but heres my take:
For:
Mission Critical Apps and large DB's: Oracle or DB2
Mid-Range apps/Mid-sized DB's: The above + SqlServer, PostgreSQL.
Small: SqlServer, PostgreSQL. (+ Oracle and DB2 if you like to toss around the $$).
I'd feel comfortable using PostgreSQL for upto and including mid-sized DB's. Currently I wouldn't use mySQL for anything until they fix their Gotcha's. [sql-info.de]
If you really and I mean really have faith in your developers and they have reviewed these gotcha's i'd consider MySQL but unfortunately, as every DBA knows this isn't always possible. It only takes one bad apple to mess everything up.
Of course there are many other factors to choosing a database but the core comes down to your employees and licensing. If all your DBA's have extensive training on Oracle then it doesn't make much sense to retrain them to use another DB just because it maybe a better fit. Also, if you have a server license for Oracle it doesn't make much sense to buy another so you can use DB2.
At our shop we have a mix of Oracle and SqlServer. But we do installs for DB2, Redbrick, informix, everything and anything under the sun.
Anyways, thats my 2 bits.
Re:Can it Compete with Oracle or DB2? (Score:2)
Re:Can it Compete with Oracle or DB2? (Score:2)
Oracle for "mission-critical"? I don't see how any one could feel comfortable putting the life of their company in the hands of another company like that.
So they should code their own RDBMS and put the life of their company in their own, likely non-RDBMS-expert hands? Maybe I missed your point but I don't see how your post make any sense?
Re:Can it Compete with Oracle or DB2? (Score:3, Insightful)
The user of PostgreSQL has a whole market of developers to choose from. The user of Oracle has only one choice, and that company is known for taking a monopolist*'s rents from its customers.
Re:Can it Compete with Oracle or DB2? (Score:3, Interesting)
We had problems with MS IIS servers at a big financial services company - did they help us? No
Did we have the premium "MS fucked us so hard, we got a plaque for it" service/support contract? Yes.
Did we sue them? No fucking way.
Has any major software company ever been sued over the bugs or failures or problems caused by their software?
If it has happened, it is nowhere near the rate of problems that their software has caused.
I'd like to slap the shit out of th
Re:Can it Compete with Oracle or DB2? (Score:2)
Re:Can it Compete with Oracle or DB2? (Score:2)
On the other hand you could have a relatively low number of users, say a data warehouse but have hundreds of gigs of data.
Application complexity plays a part as well. So if your asking me its hard to set ranges as to what is/isn't a large database.
Re:Can it Compete with Oracle or DB2? (Score:2)
Small: SqlServer, PostgreSQL. (+ Oracle and DB2 if you like to toss around the $$).
Don't forget that Oracle Standard Edition One is less expensive than SQLServer.
Re:Can it Compete with Oracle or DB2? (Score:3, Interesting)
I have. As the original poster said, there is usually a DBA involved.
You want to see Oracle corrupt something? Easy. Just install a half dozen oracle homes, from 8.0.6 through 9i, use any random version of sqlplus, sqldba that happens to be in the path to do things like create new tablespaces on whatever
Not fair! (Score:3, Insightful)
Re:Can it Compete with Oracle or DB2? (Score:3, Interesting)
At least if I extrapolate what I'm seeing in the enterprise, Oracle's total revenue would go down 80%. That's why they were already FUDing around in 2002 when the decision about the
Let the flames begin (Score:3, Funny)
Database Questions (Score:2)
Has any project ever built a IOSLAVE/VFS/LUFS filesystem bridge to a relational database?
as TFA tells you, (Score:2)
Re:Database Questions (Score:2)
Set $PGDATA to where you want the files stored.
Re:Database Questions (Score:2)
Re:Database Questions (Score:5, Insightful)
Microsoft's on the way to doing it, and there was a small project that existed for a few months that allowed GNOME to access a database as a file system (It was very nasty; involved a kernel patch (a CORBA orb) that nobody was too happy about, so the project never took off.)
I've thought about the problem a few times. It requires the kernel pass information back to user space, unless the database was actually incorporated into kernel space (and that won't blow over well for a number of reasons). Passing the data back to user space requires a messaging system. The problem is, there are very few messaging systems out there designed specifically for kernelspace-userspace communication. CORBA was one developers answer; my answer would to be to ground up a protocol (because I feel that a network messaging solution, i.e. TCP/IP, can't be secured well enough in the long run).
Lastly, a daemon needs to exist to listen to the calls from the kernel and interpret them into SQL. This could be built into the kernel itself, but once again you have to question the security of the kernel building an SQL query that would go directly to the database server. Also, one of the better parts about this daemon would be metadata extraction; since the daemon is virtually transparent to both the user and the database server, the metadata can be completely ripped from the data and stored in a seperate table to allow for much faster, more optimised searches. EXIF Tags can be copied from JPEGs, ID3 tags copied from MP3s, etc.
Ideally, the daemon would be pluggable, allowing for anyone's metadata extension to be added after compiliation, but I believe that it's important to have a functional system before having a featureful system.
If you'd like to talk more about it, I'm really open to the idea of finally having an SQL-based file system. A relational database file system is the future; if we get there before Windows, we can add yet another example of the speed of open source development.
Native Win support - awesome (Score:5, Interesting)
Re:Native Win support - awesome (Score:3, Funny)
Windows support (Score:5, Interesting)
Up until this point, you have had to install hundreds of MB of cygwin to get PostgreSQL to work on Windows. I think it's a little late to usurp MySQL's market share, especially as MySQL is now entrenched in the cheap web hosting market, but at least PostgreSQL might get the respect it deserves.
MySQL faster than postgresql? (Score:4, Informative)
Back in the 6.x days postgresql had a well-deserved reputation for being, well, slow. That was back in the '90s, though.
funny (Score:3, Funny)
Re:Windows support (Score:5, Insightful)
You cannot overlook the speed aspect as well. For many, many databases, the special features of foreign keys, stored procedures, etc. are not required. I have worked extensively with Oracle databases in the past, so I am well aware of the advantanges of these advanced features. However, in my current company, there has been no need. Most of our databases, while large, consist of a very small number of tables. The vast majority of our searches are performed on a single table, and these searches are completely optimized for speed. Stored procedures will not help in these scenarios, and foreign keys are not needed. I imagine there are a lot of web sites and applications that have the same characteristics.
I will not deny that the Windows support is huge, but it is not the only factor in MySQL's court. Speed is a huge issue, especially in the database world.
Re:Windows support (Score:3, Insightful)
I can agree with you, if you want to get a lousy job done fast, then MySQL is exactly that type of DBMS you pick. I mean, if you have few, mostly not conflicting, updates and mostly just need fast query, you will be fine.
On the other hand, if you want a full scale, acid compliant, transaction oriented DBMS, and your priority is many updates and fewer
Re:Windows support (Score:4, Informative)
MySQL cannot partition data and then either: 1. eliminate partitions and only perform i/o on the relevant one(s), 2. process against all partitions in parallel.
MySQL cannot maintain aggregated images of your data an re-write ad-hoc queries to use the aggregates.
MySQL cannot store metadata that will tell it that postal code implies county, and hence a query that wants data aggregated to the county can use the image of data at postal code granularity. (It is not true that postal code implies county, but you get my point).
MySQL cannot perform an efficient hash-join to save its life (even though a properly designed hash join is mathematically superior in a great many cases) -- and so it falls back on sort-merge regularly.
MySQL cannot re-write NOT IN or NOT EXISTS clauses as merge anti-joins. Neither can it re-write IN or EXISTS clauses as merge outer-joins.
I have to get back to work now, but surely you get the idea.
Cheers,
Scott
Re:Windows support (Score:3, Insightful)
MySQL only fast for single user? (Score:5, Informative)
Using a TPC-W style benchmark suite implemented with Apache, PHP4 and either MySQL 4.1.1 or PostgreSQL 7.4.2, I get more or less the same performance. Because of the transactional requirements and the update concurrency, all tables are InnoDB, of course. Based on that I cannot but contradict your claims about MySQL's scalability (and I am a PostgreSQL CORE developer). It keeps well up and is stable even under heavy load. Where the test uses a stored procedure in PostgreSQL, it must use a bunch of PHP code and separate query calls in the MySQL case, but that is exactly what developers do today and since the Apache server is part of the benchmarked system, this is as fair as possible.
That said, Apache+PHP+DB is the environment most people are talking about when they speak about simple to medium complex Web applications. With the scalability and performance being head to head, why would someone voluntarily miss stored procedures, views, triggers and all the other yet to be done for MySQL features? And while the (new in 4.1) subselect support makes it possible to get all of the TPC-W functionality implemented at all, to get it running fast enough in MySQL one has to rewrite some queries in a manner that I would call unmaintainable code. These complex features are not something where you can say "Transactions, checkmark". You have to look at how complete the implementation is and how well the query optimizer can deal with queries that use that feature.
So looking at the two right now, with the performance advantage gone, and the Win32 support knocking at the door, replication available and tons of well settled features in the HISTORY that are still on MySQL's ROADMAP, PostgreSQL is not just the better choice in some cases. It is ahead
Sincerely, Jan
Re:Windows support (Score:3, Insightful)
That blanket statement is simply not true. Most people think that a single user with a single query is a measure of speed. For most applications, it is not. And bluntly, this is exactly where MySQL's performance advantage starts and stops. MySQL simply does not scale nearly as well as just about any other RDBMS you'll find, including PostgreSQL.
Granted, there are still some corner cases where I'm sure MySQL is faster, especial
what about distributed transactions? (Score:3, Interesting)
Re:what about distributed transactions? (Score:3, Informative)
It is likely work will continue on this feature, though don't expect a replication system to be based on this as there are a number of problems within the spec itself (failure modes that leave the system essentially out of order).
See the pgsql-hackers archives (Google Groups) for details.
Re:what about distributed transactions? (Score:3, Interesting)
2PC will probably be integrated in 8
Re:what about distributed transactions? (Score:4, Informative)
Yes. IIRC, in the last release, the protocol has been expanded to allow for this concept. Nested transactions were also required. These are now in place. I'd guess that two phase commits and distributed transactions (sometime after 2pc) will follow sometime after the 8.0 series stablizes.
In other words, it's on their radar but I don't know what priority they are placing on it.
Some nice performance enhancements (Score:5, Interesting)
The improvement to the VACUUM I/O processor is important for Postgre to be used on a multi-app server. The 'play nice' feature will allow one server to house the DB AND web servers (albeit at a performance hit to the DB processes).
Overall, a nice improvement.
Why the red wheelbarrow ? (Score:2)
Shouldn't it be an Elephant, nickname Slonik (Russian for small elephant)
PG in Webmin. (Score:2)
(Can't think of any right now, but there are things...)
Tablespace nice...but (Score:2)
That is you allocate one file to a certain size. The file is a collection of database pages. Each page can be used by a table or index to store data.
This makes for much faster backups, and management. I can detach a database, copy the file somewhere, and reattach. There is a lot less file overhead since you lock on to a few files, versus a different file for
P.I.T.R (Score:3, Interesting)
Tablespaces are also a key feature. The nicest thing about tablespaces is: each schema can have its own tablespace. This makes maintenance much, much easier, allowing you to isolate the data for each of multiple applications or developers. You can also use it to isolate mission-critical data within the same schema, which in many cases can keep your app running, even if you lose a non-critical portion of your database.
Savepoints are nice, but I've never had to use them. And altering column data types is nifty, but not really useful in the real world.
Btw, does PostgreSQL have row-level locking yet?
Re:P.I.T.R (Score:5, Informative)
Static docs provide your answers. [postgresql.org]
Remember, one of the points of using MVCC is to avoid row locking whenever possible. But, I think you'll be hard pressed to come up with a situation where your desired locking facilities are not provided for with PostgreSQL.
To quote the online documentation:
"In addition to table-level locks, there are row-level locks. A row-level lock on a specific row is automatically acquired when the row is updated (or deleted or marked for update). The lock is held until the transaction commits or rolls back. Row-level locks do not affect data querying; they block writers to the same row only."
Really cool stuff in PostgreSQL (Score:5, Informative)
Re:Really cool stuff in PostgreSQL (Score:3, Informative)
Unfortunately, the inheritance doesn't currently handle things like pks and unique indexes across the inherited tables. sigh.
Windows Native Support (Score:5, Interesting)
Cheers
Adolfo
Re:*cough* bullshit *cough* (Score:3, Funny)
Re:Two things (Score:3, Informative)
Nothing. It's even an incorrect category. A database is the data you collect. PostgreSQL is a DataBase Management System (DBMS). They should rename the category to reflect this.
Re:Newbie Question - UI Tool (Score:2)
TOra Rocks! Does just about everything TOAD does and more, plus it's free.
Oh, right, you're on Windows... Maybe you can compile it under Cygwin.
Re:Newbie Question - UI Tool (Score:3, Informative)
Re:Newbie Question - UI Tool (Score:5, Informative)
Sure! Here's how to get it: (Score:4, Informative)
It's supported 64-bit for as long as I can remember.
steve
Re:not yet on par with MySQL (Score:2)
[Nice troll...
Re:not yet on par with MySQL (Score:2)
Postgresql supports classic BLOBs perfectly well. It _also_ supports bytea (binary string) fields. Has done for a long time.
Re:not yet on par with MySQL (Score:4, Interesting)
Are you kidding me? If you like to do everything in your app that _should_ have been handled by the DBMS then yeah, sure
you can't have a DBMS which makes both happy: there are opposing roles.
Well, I don't think I'd agree with that, but if anything I'd say MySQL is the easier one to administer. Postgres needs a lot more thought with regards to tuning and user management.
Especially user management in Postgres is, in my view, horrible and a lot better in MySQL. Well, can't have it all I guess
Re:DROP COLUMN, ALTER COLUMN TYPE and SQL-99 Specs (Score:5, Informative)
If it can be cast directly (integer to numeric) it will do so implicitly.
So, integer to smallint will do part of the work -- but if it fails (comes across a number that won't fit in the smallint) then it will rollback -- nothing lost but a little time (most PostgreSQL commands are atomic and transactional).
However, you can use an expression to do the conversion if you have something stranger in mind -- it's essentially run as an UPDATE.
Excuse the crappy formatting.
BEGIN;
SAVEPOINT altertab;
ALTER TABLE tab
ALTER COLUMN text_col TYPE bool
EXPRESSION (CASE WHEN text_col = 'SOMETHING'
THEN TRUE
ELSE THEN FALSE
END);
ROLLBACK TO altertab;
ALTER TABLE tab
ALTER COLUMN text_col TYPE bool
EXPRESSION (CASE WHEN text_col IN ('SOMETHING', 'OR', 'ANOTHER')
THEN TRUE
ELSE THEN FALSE
END);
COMMIT;
Re:Does the on-disk format still change at every r (Score:4, Informative)
One of the points of Slony-I [slony.info] is to provide an answer to this very problem. Slony-I supports versions 7.3, 7.4, and 8.0, and may be used to support a short-outage upgrade path.
Suppose you have a 7.3 database, and want an 8.0 one. You set up replication between the 7.3 database and the new 8.0 one. It may take a couple of days for the new one to get up to date, but you don't have to shut the 7.3 one down.
Once the databases are more or less in sync, you do a MOVE SET to change the "master" to be the 8.0 database. Since they are nearly in sync, this should only take a few seconds. Presto! The 8.0 database is the "master," and you can switch over to it with whatever brief outage is needed to get your application to point to a new server.
Re:Does the on-disk format still change at every r (Score:3, Insightful)
There has been a project for upgrading in place, but it just hasn't had enough man power thrown at it to be a viable solution.
Maybe it's time for you to volunteer?
Re:But does it have finer grained locking (Score:4, Informative)
I'm running 7.4.2 here and I get this:
Session 1:
test=# insert into car_type values ( 1 )
INSERT 33665 1
test=# BEGIN; INSERT INTO car (car_type_id) values(1);
BEGIN
INSERT 33666 1
Session 2:
test=# begin; insert into car( car_type_id) values ( 1 )
ERROR: current transaction is aborted, commands ignored until end of transaction block
ERROR: current transaction is aborted, commands ignored until end of transaction block
Sounds like he's fudding, using a different isolation level, or using an old version of PostgreSQL.
Prehaps he can restate exactly what his problem is and exactly what his test case is. As he presented it, it would simply fail because of a forign key constraint. As you can see, I inserted a row to allow it...but, it sounds like he's confused or only telling part of the story.
Re:[grumble, grumble, grumble] (Score:3, Interesting)