Re: [SQL] Insane behaviour in 8.3.3

2012-06-18 Thread Karsten Hilbert
On Mon, Jun 18, 2012 at 11:36:14AM +0300, Achilleas Mantzios wrote: Not talking about going to something after 8.3.19, just updating to the latest 8.3 version. On most systems it's a simple: sudo apt-get upgrade or similar and sit back and watch. Thanx, unfortunately

Re: [SQL] column type for pdf file

2011-05-19 Thread Karsten Hilbert
On Thu, May 19, 2011 at 09:39:54AM -0400, Emi Lu wrote: All right, it seems that everyone thinks saving a pdf into postgresql is not a good idea. No. As a summary, disadvantages are: == . Memory issue when read/save/retrieve the file . Increase load Those

Re: [SQL] column type for pdf file

2011-05-18 Thread Karsten Hilbert
On Wed, May 18, 2011 at 10:46:23PM +0200, Julien Cigar wrote: Unless you've good reasons to do so it's best to store the file on the file system Why ? If you suggest reasons are needed for storing the PDF in the database I'd like to know the reasons for *not* doing so. Karsten -- GPG key ID

Re: [SQL] column type for pdf file

2011-05-18 Thread Karsten Hilbert
On Wed, May 18, 2011 at 11:21:43PM +0200, Julien Cigar wrote: Unless you've good reasons to do so it's best to store the file on the file system Why ? If you suggest reasons are needed for storing the PDF in the database I'd like to know the reasons for *not* doing so. It increases the

Re: [SQL] Select default values

2008-07-23 Thread Karsten Hilbert
On Wed, Jul 23, 2008 at 12:35:08PM +0200, Maximilian Tyrtania wrote: With your way (insert into f(a,b) values(default, default) returning *) i need to know everything about the given table. Hmm. Any ideas? Do look at the information schema. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net

Re: [SQL] What are the (various) best practices/opinions for table/column/constraint naming?

2008-02-09 Thread Karsten Hilbert
Speaking on behalf of the GNUmed schema. The type of thing comes first for consistency. primary key: pk Some might argue pk_table_name is preferrable such that in joins one ist not forced to use column aliases. We do in such cases. The ... where table.pk = ... just seems soo

Re: [SQL] help with version checking

2006-12-29 Thread Karsten Hilbert
In GNUmed we have created a function gm_concat_table_structure() in http://cvs.savannah.gnu.org/viewcvs/gnumed/gnumed/server/sql/gmSchemaRevisionViews.sql?rev=1.6root=gnumedview=log which returns a reproducable, human-readable TEXT concatenation of all the relevant parts of

Re: [SQL] Check/unique constraint question

2006-03-05 Thread Karsten Hilbert
On Sun, Mar 05, 2006 at 12:02:58PM +0300, Nikolay Samokhvalov wrote: Unfortunately, at the moment Postgres doesn't support subqueries in CHECK constraints, so it's seems that you should use trigger to check what you need The OP could also use a check constraint with a function if everything

Re: [SQL] newbie question

2006-03-03 Thread Karsten Hilbert
On Fri, Mar 03, 2006 at 10:43:09AM +0100, ivan marchesini wrote: I have fastly created a table in a postgresql database.. some columns where edited by hand (columns A, B, C), and some others (columns D, E, F) have been calculated as a result of mathematical equation (where the factors are the

Re: [SQL] newbie question

2006-03-03 Thread Karsten Hilbert
On Fri, Mar 03, 2006 at 12:30:20PM +0100, ivan marchesini wrote: another question... is it possible to copy a table to a view and then back the view to a table??? You need to read a basic textbook about what a view is. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA

Re: [SQL] Function Dependency

2006-02-06 Thread Karsten Hilbert
On Sun, Feb 05, 2006 at 07:18:33PM -0700, Tony Wasson wrote: I am maintaining an application that has over 400 procedures and functions written in plsql, and around 100 tables. I want to generate a function dependency chart to depict the following: 1. Inter function/procedure

Re: [SQL] Trigger on select?

2005-08-03 Thread Karsten Hilbert
On Tue, Aug 02, 2005 at 05:54:59PM -0700, Chris Travers wrote: Hey, anyone know if it is possible to fire a trigger before a select? I'm considering creating some tables which contain data summarized from other tables as kind of a cache mechanism. The hope is I can speed up some queries

Re: [SQL] Information about the command SQL create synonym.

2005-02-03 Thread Karsten Hilbert
Much like yourself, I have been searching for a way to create synonyms in Postgres. I think that I have found a hack / solution to our problem. ... What I did, was to make use of the Postgres inheritance feature. This in turn effectively creates an alias: CREATE TABLE foo (bar int not

Re: [SQL] Returning a bool on DELETE in a proc.

2005-01-19 Thread Karsten Hilbert
So what variable/function is the correct SQL-equivalent to ROW_COUNT and can it be used in the following statement ? like DELETE...; SELECT (ROW_COUNT0); to return a bool value? SQL doesn't support that (although I suppose it could be made to with some pg_rows_affected() function). If

Re: [SQL] inserting values into types

2004-12-01 Thread Karsten Hilbert
CREATE TYPE qwerty_UDT AS (abc INT); CREATE TABLE t (col1 qwerty_UDT); INSERT INTO t (col1) VALUES (qwerty_UDT(123)); ERROR: function qwerty_udt(integer) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type casts. Well,

Re: [SQL] UPDATE/INSERT on multiple co-dependent tables

2004-11-14 Thread Karsten Hilbert
Is it possible for an UPDATE/INSERT query string to function in such a way that it requires two like fields in different tables to be equal to/'in sync with' one another: Example: I have two tables: registration schedules they both record a class_id, start_date, end_date... I want

Re: [SQL] postgreSQL 8beta

2004-11-13 Thread Karsten Hilbert
does postgresql have a datatype 'other' which in hsqldb is an Object? I am trying to convert the table below into postgreSQL 8: create table TIMERS ( TIMERID varchar(50) not null, TARGETID varchar(50) not null, INITIALDATE timestamp not null, INTERVAL bigint, INSTANCEPK

Re: [SQL] bibliographic schema

2004-10-19 Thread Karsten Hilbert
we're looking for a SQL database schema for bibliographical references. the goal is to extract all the bibliographical references contained in our various existing pgsql scientific databases in only one specific database and to interconnect them with external keys and perl scripts. Your

Re: [SQL] [GENERAL] need ``row number``

2004-09-24 Thread Karsten Hilbert
to calculate something that isn't there yet. I am just trying to join two views appropriately. I might have to employ some variant of Celko's integer helper table but I'm not sure how to proceed. Karsten Karsten Hilbert [EMAIL PROTECTED] 9/23 1:56p Hello all, yes, I know, row number

[SQL] need row number

2004-09-23 Thread Karsten Hilbert
is 'boosters a patient has not been given yet according to the schedules a patient is on and the previously received vaccinations'; Thanks, Karsten Hilbert, MD, PhD GnuMed i18n coordinator http://www.gnumed.org -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537

Re: [SQL] surrogate key or not?

2004-07-28 Thread Karsten Hilbert
retrievable. I imagine a system whereby you define keywords and attributes for them (attributes would be an episode date, or dosage, etc). This is pretty much exactly what we are working on. We are factoring out data into dedicated tables where that is possible due to the structured nature of

Re: [SQL] surrogate key or not?

2004-07-28 Thread Karsten Hilbert
simpler, as a first stage and easily implemented, give him some way he can tag words and phrases he feels important. save these in a table along with a foreign key identifying the source. as a second stage keep analysing the words and phrases chosen and empirically build up a database of

Re: [SQL] surrogate key or not?

2004-07-26 Thread Karsten Hilbert
This reminds me of a project I worked on many years ago, I was pretty much fresh out of university writing a system for a large medical practice - itwas principally for accounting purposes. I made lots of suggestions like Josh's, only to get replies like Karsten's. I the progammer wanted to

Re: [SQL] surrogate key or not?

2004-07-24 Thread Karsten . Hilbert
Josh, In other words, with surrogate keys, you eliminate the chance that your original design was flawed due to lack of important initial knowledge. Well, you don't *eliminate* it, but you do decrease it. I'd say, yes, this is an important 4th reason: 4) Your spec may be

Re: [SQL] surrogate key or not?

2004-07-24 Thread Karsten Hilbert
On Fri, Jul 23, 2004 at 10:07:48AM -0400, Tom Lane wrote: The other standard reason for using a made-up value as primary key is that it's under your control and you can guarantee it isn't going to change: one record will have the same primary key for its entire life, which vastly simplifies

Re: [SQL] surrogate key or not?

2004-07-24 Thread Karsten Hilbert
Just for the record, the GnuMed schema docs are done nightly with PostgreSQL Autodoc in HTML mode: http://www.rbt.ca/autodoc/ Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 ---(end of

Re: [SQL] surrogate key or not?

2004-07-23 Thread Karsten Hilbert
/schema/ Lot's of it isn't in the state yet where we want it but we are getting there - or so I think. Karsten Hilbert, MD, PhD Leipzig, Germany -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 ---(end of broadcast

Re: [SQL] surrogate key or not?

2004-07-22 Thread Karsten Hilbert
Josh, I reckon you are the one in the know so I'll take advantage of that and ascertain myself of your advice. I am the primary designer for the database schema of GnuMed (www.gnumed.org) - a practice management application intended to store medical data. Obviously we wouldn't want ambigous

Re: [SQL] Need indexes on inherited tables?

2004-06-26 Thread Karsten Hilbert
Is this a possible area for future enhancements? Yes. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 ---(end of broadcast)--- TIP 8: explain analyze is your friend

Re: [SQL] Find out whether a view's column is indexed?

2004-06-10 Thread Karsten Hilbert
and I can see whether a sequential scan or an index scan is performed, but parsing the output of EXPLAIN programmatically is nearly impossible. Anyway the words 'Index Scan' and 'Seq Scan' can change without notice, maybe even from one locale to another. I think you are operating under the

Re: [SQL] Very slow search using basic pattern matching

2004-05-18 Thread Karsten Hilbert
WHERE da_records.DESCRIPTION_CY ~* '.*Aberystwyth*.' OR da_records.TITLE_CY ~* '.*Aberystwyth*.' limit 100 Is there a better way of matching the string? (Must be case insensitive) Are you sure you can't anchor the search pattern ? eg ~* '^' || lower('Aberystwyth')

Re: [SQL] Unique Constraint with foreign Key

2004-05-17 Thread Karsten Hilbert
or Can i have varchar types of size 50 as primary keys in Postgres. Yes. But unless the 50 character limit comes from a business rule, you might want to use the type 'text'. And if that limit does come from a business rule you might want to think twice whether using columns constrained by

Re: [SQL] Equivalant of SQL Server's Nchar and NVARCHAR

2004-04-29 Thread Karsten Hilbert
Dear friends, Is there [...] Please shed some light. http://www.postgresql.org/docs/7.4/static/index.html Thanks You are welcome. Karsten -- GPG key ID E4071346 @ wwwkeys.pgp.net E167 67FD A291 2BEA 73BD 4537 78B9 A9F9 E407 1346 ---(end of

Re: [SQL] Python connection

2004-04-26 Thread Karsten Hilbert
a) this is the wrong mailing list for your question b) obviously, it doesn't like the , part (and possibly the host part but that remains to be seen), try separating by : or just space or whatever libpq docs say c) any particular reason you don't use the Python DB API ? Karsten -- GPG key

Re: [SQL] Tip: a function for creating a remote view using dblink

2004-02-17 Thread Karsten Hilbert
Hello, I'm posting a function here in the hope others may find it useful and/or correct my mistakes/make improvements :) This creates a view of a remote table, using dblink: ... Is there any existing site (a wiki for example) for posting PostgreSQL specific tips? The PG cookbook ?

[SQL] how to enumerate rows ?

2004-01-26 Thread Karsten Hilbert
I sent this to pgsql-general first but eventually figured this list is the more appropriate venue for asking for help. If this happens to be a FAQ item please briefly point me where to go or what search terms to use in the archive. First of all, yes I know that result rows don't have any