Обсуждение: data dictionary?

Поиск
Список
Период
Сортировка

data dictionary?

От
Beth Gatewood
Дата:
Hi-

New to PostGreSQL...previously used Oracle.

Could someone please tell me where the Data Dictionary is located?
Specifically, I want to get a list of tables.  I know about the \dt
command but I would like to see where this is actually stored (so that I

can execute SQL against it).

TIA-

Beth


Re: data dictionary?

От
"D. Duccini"
Дата:
if you can see them with \dt you can execute SQL against them ;)

unless you're talking about system tables

On Wed, 18 Oct 2000, Beth Gatewood wrote:

> Hi-
>
> New to PostGreSQL...previously used Oracle.
>
> Could someone please tell me where the Data Dictionary is located?
> Specifically, I want to get a list of tables.  I know about the \dt
> command but I would like to see where this is actually stored (so that I
>
> can execute SQL against it).
>
> TIA-
>
> Beth
>


-----------------------------------------------------------------------------
david@backpack.com            BackPack Software, Inc.        www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
-----------------------------------------------------------------------------


Re: data dictionary?

От
Beth Gatewood
Дата:
yes- I figured that was the case and why I sent it to novice ;-)

I am referring to the the system tables (in Oracle the sql  would be something
like select * from user_tables".

Thanks-
Beth

"D. Duccini" wrote:

> if you can see them with \dt you can execute SQL against them ;)
>
> unless you're talking about system tables
>
> On Wed, 18 Oct 2000, Beth Gatewood wrote:
>
> > Hi-
> >
> > New to PostGreSQL...previously used Oracle.
> >
> > Could someone please tell me where the Data Dictionary is located?
> > Specifically, I want to get a list of tables.  I know about the \dt
> > command but I would like to see where this is actually stored (so that I
> >
> > can execute SQL against it).
> >
> > TIA-
> >
> > Beth
> >
>
> -----------------------------------------------------------------------------
> david@backpack.com            BackPack Software, Inc.        www.backpack.com
> +1 651.645.7550 voice       "Life is an Adventure.
> +1 651.645.9798 fax            Don't forget your BackPack!"
> -----------------------------------------------------------------------------


Re: data dictionary?

От
"D. Duccini"
Дата:
its a good point. i use oracle almost daily for clients, and have been
thinking of writing a knock off of sqlplus to take oracle "concepts" like
"dual" or "sys.tab"


> yes- I figured that was the case and why I sent it to novice ;-)
>
> I am referring to the the system tables (in Oracle the sql  would be something
> like select * from user_tables".
>
> Thanks-
> Beth
>
> "D. Duccini" wrote:
>
> > if you can see them with \dt you can execute SQL against them ;)
> >
> > unless you're talking about system tables
> >
> > On Wed, 18 Oct 2000, Beth Gatewood wrote:
> >
> > > Hi-
> > >
> > > New to PostGreSQL...previously used Oracle.
> > >
> > > Could someone please tell me where the Data Dictionary is located?
> > > Specifically, I want to get a list of tables.  I know about the \dt
> > > command but I would like to see where this is actually stored (so that I
> > >
> > > can execute SQL against it).
> > >
> > > TIA-
> > >
> > > Beth
> > >
> >
> > -----------------------------------------------------------------------------
> > david@backpack.com            BackPack Software, Inc.        www.backpack.com
> > +1 651.645.7550 voice       "Life is an Adventure.
> > +1 651.645.9798 fax            Don't forget your BackPack!"
> > -----------------------------------------------------------------------------
>


-----------------------------------------------------------------------------
david@backpack.com            BackPack Software, Inc.        www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
-----------------------------------------------------------------------------


Re: data dictionary?

От
Thomas Good
Дата:
On Wed, 18 Oct 2000, Beth Gatewood wrote:

> Hi-
>
> New to PostGreSQL...previously used Oracle.
>
> Could someone please tell me where the Data Dictionary is located?
> Specifically, I want to get a list of tables.  I know about the \dt
> command but I would like to see where this is actually stored (so that I
>
> can execute SQL against it).

Hi Beth,

SELECT * FROM pg_class;

is a good place to start when querying the system catalogue.
BTW, default tables (sys catalogue) are stored in:

/usr/local/pgsql/data/base/template1

Cheers,
Tom

--------------------------------------------------------------------
               SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good                          tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA                 Phone: 718-354-5528
                                     Fax:   718-354-5056
--------------------------------------------------------------------
Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
               RDBMS       |---------- linux      The Power To Serve
--------------------------------------------------------------------


Re: data dictionary?

От
Beth Gatewood
Дата:
So does this mean that there is no such thing as System Tables?

I would really like to write some code that would be able to query any database,
grab out the tables and then do a row count on  each table.  Obviously I could do
this by hand, singly executing \dt but this will be taking a long time.

Any thought on this?

Thanks-
Beth
"D. Duccini" wrote:

> its a good point. i use oracle almost daily for clients, and have been
> thinking of writing a knock off of sqlplus to take oracle "concepts" like
> "dual" or "sys.tab"
>
> > yes- I figured that was the case and why I sent it to novice ;-)
> >
> > I am referring to the the system tables (in Oracle the sql  would be something
> > like select * from user_tables".
> >
> > Thanks-
> > Beth
> >
> > "D. Duccini" wrote:
> >
> > > if you can see them with \dt you can execute SQL against them ;)
> > >
> > > unless you're talking about system tables
> > >
> > > On Wed, 18 Oct 2000, Beth Gatewood wrote:
> > >
> > > > Hi-
> > > >
> > > > New to PostGreSQL...previously used Oracle.
> > > >
> > > > Could someone please tell me where the Data Dictionary is located?
> > > > Specifically, I want to get a list of tables.  I know about the \dt
> > > > command but I would like to see where this is actually stored (so that I
> > > >
> > > > can execute SQL against it).
> > > >
> > > > TIA-
> > > >
> > > > Beth
> > > >
> > >
> > > -----------------------------------------------------------------------------
> > > david@backpack.com            BackPack Software, Inc.        www.backpack.com
> > > +1 651.645.7550 voice       "Life is an Adventure.
> > > +1 651.645.9798 fax            Don't forget your BackPack!"
> > > -----------------------------------------------------------------------------
> >
>
> -----------------------------------------------------------------------------
> david@backpack.com            BackPack Software, Inc.        www.backpack.com
> +1 651.645.7550 voice       "Life is an Adventure.
> +1 651.645.9798 fax            Don't forget your BackPack!"
> -----------------------------------------------------------------------------


Re: data dictionary?

От
"D. Duccini"
Дата:
oh no, there are system tables

check out

/dS


On Wed, 18 Oct 2000, Beth Gatewood wrote:

> So does this mean that there is no such thing as System Tables?
>
> I would really like to write some code that would be able to query any database,
> grab out the tables and then do a row count on  each table.  Obviously I could do
> this by hand, singly executing \dt but this will be taking a long time.
>
> Any thought on this?
>
> Thanks-
> Beth
> "D. Duccini" wrote:
>
> > its a good point. i use oracle almost daily for clients, and have been
> > thinking of writing a knock off of sqlplus to take oracle "concepts" like
> > "dual" or "sys.tab"
> >
> > > yes- I figured that was the case and why I sent it to novice ;-)
> > >
> > > I am referring to the the system tables (in Oracle the sql  would be something
> > > like select * from user_tables".
> > >
> > > Thanks-
> > > Beth
> > >
> > > "D. Duccini" wrote:
> > >
> > > > if you can see them with \dt you can execute SQL against them ;)
> > > >
> > > > unless you're talking about system tables
> > > >
> > > > On Wed, 18 Oct 2000, Beth Gatewood wrote:
> > > >
> > > > > Hi-
> > > > >
> > > > > New to PostGreSQL...previously used Oracle.
> > > > >
> > > > > Could someone please tell me where the Data Dictionary is located?
> > > > > Specifically, I want to get a list of tables.  I know about the \dt
> > > > > command but I would like to see where this is actually stored (so that I
> > > > >
> > > > > can execute SQL against it).
> > > > >
> > > > > TIA-
> > > > >
> > > > > Beth
> > > > >
> > > >
> > > > -----------------------------------------------------------------------------
> > > > david@backpack.com            BackPack Software, Inc.        www.backpack.com
> > > > +1 651.645.7550 voice       "Life is an Adventure.
> > > > +1 651.645.9798 fax            Don't forget your BackPack!"
> > > > -----------------------------------------------------------------------------
> > >
> >
> > -----------------------------------------------------------------------------
> > david@backpack.com            BackPack Software, Inc.        www.backpack.com
> > +1 651.645.7550 voice       "Life is an Adventure.
> > +1 651.645.9798 fax            Don't forget your BackPack!"
> > -----------------------------------------------------------------------------
>


-----------------------------------------------------------------------------
david@backpack.com            BackPack Software, Inc.        www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
-----------------------------------------------------------------------------


Re: data dictionary?

От
Tom Lane
Дата:
Beth Gatewood <bethg@mbt.washington.edu> writes:
> I would really like to write some code that would be able to query any
> database, grab out the tables and then do a row count on each table.
> Obviously I could do this by hand, singly executing \dt but this will
> be taking a long time.

psql's backslash commands don't do anything you couldn't do for
yourself.  To see what they're doing, start psql with -E switch to
make it echo the SQL commands it's sending.

One thing you do have to watch out for is that details of the system
catalogs tend to change from release to release, so if you do anything
too fancy you might find it broken at some point in the future...

            regards, tom lane

changing data type

От
Chris
Дата:
Hi all,

I tried to do a search for this, but couldn't find anything.
How do I change a datatype in postgres?
eg, change a column from being "text" to "varchar".

Thanks
------------------------
Chris Smith
http://www.squiz.net

Re: changing data type

От
"D. Duccini"
Дата:
can't do it (in 6.x)

the best you can do is

alter table rename column1 to oldcolumn1

alter table add column1 attr type;

then insert into it from the old one

alternately, dump the data out, and reload into your new table



On Thu, 19 Oct 2000, Chris wrote:

> Hi all,
>
> I tried to do a search for this, but couldn't find anything.
> How do I change a datatype in postgres?
> eg, change a column from being "text" to "varchar".
>
> Thanks
> ------------------------
> Chris Smith
> http://www.squiz.net
>


-----------------------------------------------------------------------------
david@backpack.com            BackPack Software, Inc.        www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
-----------------------------------------------------------------------------


Re: changing data type

От
Дата:
On Thu, 19 Oct 2000, D. Duccini wrote:

> can't do it (in 6.x)
>
> the best you can do is
>
> alter table rename column1 to oldcolumn1
>
> alter table add column1 attr type;
>
> then insert into it from the old one
>
> alternately, dump the data out, and reload into your new table

Haven't you people read the online docs?  There's an entire chapter
(chapter 5 in the 'postgres' document), devoted to type conversion, not to
mention a listing of type conversion functions (among others) in chapter 4
of that same document.

I hate answering inquires with just RTFM, but in this case, RTFM! :-)

Brett W. McCoy
                                              http://www.chapelperilous.net
---------------------------------------------------------------------------
She's the kind of girl who climbed the ladder of success wrong by wrong.
        -- Mae West


Re: changing data type

От
"D. Duccini"
Дата:
Dude, chill.

My approach is "generic" and works across just about every SQL database
manager out there....

peace

-duck


> Haven't you people read the online docs?  There's an entire chapter
> (chapter 5 in the 'postgres' document), devoted to type conversion, not to
> mention a listing of type conversion functions (among others) in chapter 4
> of that same document.
>
> I hate answering inquires with just RTFM, but in this case, RTFM! :-)
>
> Brett W. McCoy
>                                               http://www.chapelperilous.net
> ---------------------------------------------------------------------------
> She's the kind of girl who climbed the ladder of success wrong by wrong.
>         -- Mae West
>


Re: changing data type

От
Thomas Good
Дата:
On Thu, 19 Oct 2000 bmccoy@chapelperilous.net wrote:

> On Thu, 19 Oct 2000, D. Duccini wrote:
>
> > can't do it (in 6.x)
> >
> > the best you can do is
> >
> > alter table rename column1 to oldcolumn1
> >
> > alter table add column1 attr type;
> >
> > then insert into it from the old one
> >
> > alternately, dump the data out, and reload into your new table
>
> Haven't you people read the online docs?  There's an entire chapter
> (chapter 5 in the 'postgres' document), devoted to type conversion, not to
> mention a listing of type conversion functions (among others) in chapter 4
> of that same document.
>
> I hate answering inquires with just RTFM, but in this case, RTFM! :-)

As one of the people who agitated for the creation of a NOVICE list
back when - one of the original tenets was that no question was too
naive to be asked.  And no answer of RTFM would ever be appropriate.
This was based on the FreeBSD newbies list model...

I realise that you are not terribly agitated here Brett but I would
gently remind you that everyone needs someone to say, 'oh yes, it's
on the end of your nose' - at least once in awhile (once a day in my
case.  ;-)

Now back to tripping over my own blunders...

Cheers,
Tom
--------------------------------------------------------------------
               SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good                          tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA                 Phone: 718-354-5528
                                     Fax:   718-354-5056
--------------------------------------------------------------------
Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
               RDBMS       |---------- linux      The Power To Serve
--------------------------------------------------------------------


Re: changing data type

От
Дата:
On Thu, 19 Oct 2000, D. Duccini wrote:

> My approach is "generic" and works across just about every SQL database
> manager out there....

That's fine, if one has the luxury of doing that, but dumping the data or
rebuilding tables won't work in, say, a CGI script where the data needs to
be converted on the fly.  You also said that there wasn't a way to do it
in PostgreSQL 6.x, and it's right there in the docs for PostgreSQL 6.x.

Brett W. McCoy
                                              http://www.chapelperilous.net
---------------------------------------------------------------------------
C'est magnifique, mais ce n'est pas la guerre!
    [It is magnificent, but it is not war]
        -- Pierre Bosquet, witnessing the charge of the Light Brigade


Re: changing data type

От
"D. Duccini"
Дата:
You're absolutely right.  I should have said, "i'm not sure, but here's an
approach"

and uhm, i'd be surprised if someone wants/needs to alter tables from a
cgi on the fly

unless you're confused about "type casting" -vs- altering tables
permanently

> > My approach is "generic" and works across just about every SQL database
> > manager out there....
>
> That's fine, if one has the luxury of doing that, but dumping the data or
> rebuilding tables won't work in, say, a CGI script where the data needs to
> be converted on the fly.  You also said that there wasn't a way to do it
> in PostgreSQL 6.x, and it's right there in the docs for PostgreSQL 6.x.
>
> Brett W. McCoy
>                                               http://www.chapelperilous.net
> ---------------------------------------------------------------------------
> C'est magnifique, mais ce n'est pas la guerre!
>     [It is magnificent, but it is not war]
>         -- Pierre Bosquet, witnessing the charge of the Light Brigade
>


-----------------------------------------------------------------------------
david@backpack.com            BackPack Software, Inc.        www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
-----------------------------------------------------------------------------


Re: changing data type

От
Дата:
On Thu, 19 Oct 2000, D. Duccini wrote:

> You're absolutely right.  I should have said, "i'm not sure, but here's an
> approach"
>
> and uhm, i'd be surprised if someone wants/needs to alter tables from a
> cgi on the fly
>
> unless you're confused about "type casting" -vs- altering tables
> permanently

Actually, I don't think Chris made that clear, if he was changing the
actual data types in the table, or wanted a way to change the data type
inside of a query.  But you can still use the data conversion functions to
do both.

Brett W. McCoy
                                              http://www.chapelperilous.net
---------------------------------------------------------------------------
Punishment becomes ineffective after a certain point.  Men become insensitive.
        -- Eneg, "Patterns of Force", stardate 2534.7


Setting Permissions for web viewing

От
"Kevin Leclaire"
Дата:
What's the cleanest way to set permissions in postgres so that a web
application can properly view and query a back-end database, but not modify?

I have tried modifying pg_hba.conf, and got it to do a pg_connect()
successfully, however, the subsequent pg_Exex() call failed with the
following browser error: "Warning: PostgreSQL query failed: ERROR:
table_name: Permission denied..."

Thanks!

Kevin


Re: Setting Permissions for web viewing

От
"D. Duccini"
Дата:
the problem isn't the database, its the user the webserver is running as

you can solve this by using chown and chmod u+s to make the script
execute as a known user to the database

the alernate is to pass in a fully qualified connect string specifying
user/database

-duck

On Thu, 19 Oct 2000, Kevin Leclaire wrote:

> What's the cleanest way to set permissions in postgres so that a web
> application can properly view and query a back-end database, but not modify?
>
> I have tried modifying pg_hba.conf, and got it to do a pg_connect()
> successfully, however, the subsequent pg_Exex() call failed with the
> following browser error: "Warning: PostgreSQL query failed: ERROR:
> table_name: Permission denied..."
>
> Thanks!
>
> Kevin
>


-----------------------------------------------------------------------------
david@backpack.com            BackPack Software, Inc.        www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
-----------------------------------------------------------------------------


RE: Setting Permissions for web viewing

От
"k"
Дата:
The pg_connect command worked as localhost, but then the pg_exec failed with
permission errors?

If you started from scratch, I think you would need to do the following
things:

1) determine who the "user" is that the webserver is running as (Suggestions
on how to do this?)

2) set up that user in postgres with createuser (but I'm unsure how to best
deal with the password, should it be NULL and then restrict the access or
should it have a value that you pass as a parameter down the road?  This
ties into point 4)

3) give that user permissions to access the database tables in the psql
interface with the "GRANT" command

4) figure out the best way of having the webserver (as "user") connect to
the database, e.g. the options suggested below (although I assume the first
option implies that the user is set up with a NULL password?  How would this
work exactly?)

I'm not an expert on the above, so would also appreciate input on how to
best accomplish this securely.  Are there any good how-to's on this?

Cheers!
Robert

-----Original Message-----
From: pgsql-novice-owner@hub.org [mailto:pgsql-novice-owner@hub.org]On
Behalf Of D. Duccini
Sent: Thursday, October 19, 2000 1:31 PM
To: Kevin Leclaire
Cc: pgsql-novice@hub.org
Subject: Re: [NOVICE] Setting Permissions for web viewing



the problem isn't the database, its the user the webserver is running as

you can solve this by using chown and chmod u+s to make the script
execute as a known user to the database

the alernate is to pass in a fully qualified connect string specifying
user/database

-duck

On Thu, 19 Oct 2000, Kevin Leclaire wrote:

> What's the cleanest way to set permissions in postgres so that a web
> application can properly view and query a back-end database, but not
modify?
>
> I have tried modifying pg_hba.conf, and got it to do a pg_connect()
> successfully, however, the subsequent pg_Exex() call failed with the
> following browser error: "Warning: PostgreSQL query failed: ERROR:
> table_name: Permission denied..."
>
> Thanks!
>
> Kevin
>


----------------------------------------------------------------------------
-
david@backpack.com            BackPack Software, Inc.
www.backpack.com
+1 651.645.7550 voice       "Life is an Adventure.
+1 651.645.9798 fax            Don't forget your BackPack!"
----------------------------------------------------------------------------
-



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


RE: Setting Permissions for web viewing

От
Chris
Дата:
I wrote a very basic tutorial (which also has this part in it).
http://designmagick.50megs.com/postgresql-tutorial/

It's not very comprehensive, but it has a couple of things there.

>The pg_connect command worked as localhost, but then the pg_exec failed with
>permission errors?
>
>If you started from scratch, I think you would need to do the following
>things:
>
>1) determine who the "user" is that the webserver is running as (Suggestions
>on how to do this?)

for linux, not sure if bsd is different..

# ps aux | grep http

gives a list of all the http processes running... check the first column
for the name of the process owner.

>2) set up that user in postgres with createuser (but I'm unsure how to best
>deal with the password, should it be NULL and then restrict the access or
>should it have a value that you pass as a parameter down the road?  This
>ties into point 4)

I've just never set a password.

>3) give that user permissions to access the database tables in the psql
>interface with the "GRANT" command
>
>4) figure out the best way of having the webserver (as "user") connect to
>the database, e.g. the options suggested below (although I assume the first
>option implies that the user is set up with a NULL password?  How would this
>work exactly?)

Since the user connecting to the database has access (as done with the
grant command).... all I do is
pg_connect("","","","","dbname");
although there might be other / better ways :)

Chris.

SUM agregate

От
"David Horwitz"
Дата:
Hi All,

I'm having problems with the sum() agregate function. Simply put I
want to query a table and return grouped sum agregates. The SQL im
using is:

SELECT PortfolioCurrValue.MID, Sum(PortfolioCurrValue.CurrValue) AS
PortfolioValue
FROM PortfolioCurrValue
GROUP BY PortfolioCurrValue.MID;


currValue conatins large integers ( the largest is curently
195680000) the largest sum should be un the region of 199905000. The
query returns a number of responces per 'mid' (not just the sum of
the values per mid). Infact  it apears to return a row per value

Converting the data-type to int8 seems to have no afect on the error.

Anyadvise?

Thanks

David Horwitz




****************************************************
David Horwitz                  University of Cape Town
IT Officer                     Private Bag
Multimedia Education Group     Rondebosch
                               7701
dhorwitz@its.uct.ac.za         SOUTH AFRICA
Tel:+27 21 650 3841          Fax:+27 21 650 5045
http://www.meg.uct.ac.za
*************************************************



changing datestyle

От
Thomas Good
Дата:
Hi all.

This ISO datestyle is a nuisance.  In my /etc/profile I am exporting
an env var:  export PGDATESTYLE='postgres'

This converts the date back to what ppl here are used to...but it
does not work for the web server and the nobody user.

Do I have to manually SET the variable before every SELECT ???
Geez, I hope not...

Thanks,
Tom

--------------------------------------------------------------------
               SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good                          tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA                 Phone: 718-354-5528
                                     Fax:   718-354-5056
--------------------------------------------------------------------
Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
               RDBMS       |---------- linux      The Power To Serve
--------------------------------------------------------------------


Re: changing datestyle

От
Jason Davis
Дата:
Hi

I had the same problem with my web database stuff. The trick is to put the
line

SetEnv PGDATESTYLE Postgres

in your apache.conf (assuming you are running apache). Seems to be fussy
where it goes - works if you put it directly above the User and Group
directives.

A postmaster restart will be necessary.

regards,

Jason Davis
Database Administrator/Programmer
Tas Access
www.tassie.net.au


At 11:12 AM 30/10/2000 -0500, you wrote:
>Hi all.
>
>This ISO datestyle is a nuisance.  In my /etc/profile I am exporting
>an env var:  export PGDATESTYLE='postgres'
>
>This converts the date back to what ppl here are used to...but it
>does not work for the web server and the nobody user.
>
>Do I have to manually SET the variable before every SELECT ???
>Geez, I hope not...
>
>Thanks,
>Tom
>
>--------------------------------------------------------------------
>               SVCMC - Center for Behavioral Health
>--------------------------------------------------------------------
>Thomas Good                          tomg@ { admin | q8 } .nrnet.org
>IS Coordinator / DBA                 Phone: 718-354-5528
>                                     Fax:   718-354-5056
>--------------------------------------------------------------------
>Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
>               RDBMS       |---------- linux      The Power To Serve
>--------------------------------------------------------------------
>


Re: changing datestyle

От
Thomas Good
Дата:
On Tue, 31 Oct 2000, Jason Davis wrote:

> Hi
>
> I had the same problem with my web database stuff. The trick is to put the
> line
>
> SetEnv PGDATESTYLE Postgres
>
> in your apache.conf (assuming you are running apache). Seems to be fussy
> where it goes - works if you put it directly above the User and Group
> directives.

G'Day Jason and thanks!

I did a rebuild, after editing ./src/backend/utils/init/globals.c
to say:       int           DateStyle = USE_POSTGRES_DATES;

It wasn't too tough to shutdown the server, do a make/make install
and restart but your solution is definitely more elegant.
I am going to hack my apache conf files on the other machines here
running pg7.

Cheers,
Tom

--------------------------------------------------------------------
               SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good                          tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA                 Phone: 718-354-5528
                                     Fax:   718-354-5056
--------------------------------------------------------------------
Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
               RDBMS       |---------- linux      The Power To Serve
--------------------------------------------------------------------


Re: changing datestyle

От
"Bryan White"
Дата:
> I did a rebuild, after editing ./src/backend/utils/init/globals.c
> to say:       int           DateStyle = USE_POSTGRES_DATES;
>
> It wasn't too tough to shutdown the server, do a make/make install
> and restart but your solution is definitely more elegant.
> I am going to hack my apache conf files on the other machines here
> running pg7.

I did the same thing (changed globals.c).  It seems more elegant because
only one place had to change to affect the entire system across multiple
servers, environments and programming languages.


Re: changing datestyle

От
Thomas Good
Дата:
On Tue, 31 Oct 2000, Bryan White wrote:

> > I did a rebuild, after editing ./src/backend/utils/init/globals.c
> > to say:       int           DateStyle = USE_POSTGRES_DATES;
> >
> > It wasn't too tough to shutdown the server, do a make/make install
> > and restart but your solution is definitely more elegant.
> > I am going to hack my apache conf files on the other machines here
> > running pg7.
>
> I did the same thing (changed globals.c).  It seems more elegant because
> only one place had to change to affect the entire system across multiple
> servers, environments and programming languages.

Maybe...then again I have to hack my apache conf files to setup database
access and /etc/profile to setup Pg env vars for DBI/DBD anyway.
Adding PGDATESTYLE to my conf TODO list is painless.  In fact, I use
small patches that I read in via vi...being not overly fond of typing.

I suppose it is personal preference, eh?  After all:  TMTOWTDI.  ;-)

--------------------------------------------------------------------
               SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good                          tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA                 Phone: 718-354-5528
                                     Fax:   718-354-5056
--------------------------------------------------------------------
Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
               RDBMS       |---------- linux      The Power To Serve
--------------------------------------------------------------------


Re[2]: changing datestyle

От
Jean-Christophe Boggio
Дата:
Bryan,

Ref : Tuesday, October 31, 2000 5:41:02 PM

>> I did a rebuild, after editing ./src/backend/utils/init/globals.c
>> to say:       int           DateStyle = USE_POSTGRES_DATES;
>>
>> It wasn't too tough to shutdown the server, do a make/make install
>> and restart but your solution is definitely more elegant.
>> I am going to hack my apache conf files on the other machines here
>> running pg7.

BW> I did the same thing (changed globals.c).  It seems more elegant because
BW> only one place had to change to affect the entire system across multiple
BW> servers, environments and programming languages.


Do you think changing Postgres' code is more "elegant" than configuring
your system(s) ?

What will happen when you upgrade Postgres :
* it won't work as expected
* if you have saved "somewhere" the changes you made to the source
code, you just re-apply the patches (if the location of defaults did not
change in POstgres' code)
* if not... :)
* when a new person comes to work on Postgres, he'll have to find out
what you changed, try to understand WHY you broke the code instead of
just do a little config, etc.

That's NOT what I call "elegant" and, as a project manager, I would be
quite angry with the person who messed like this.

--
Jean-Christophe Boggio
cat@thefreecat.org
Independant Consultant and Developer
Delphi, Linux, Oracle, Perl



Re: Re[2]: changing datestyle

От
Thomas Good
Дата:
On Tue, 31 Oct 2000, Jean-Christophe Boggio wrote:

> Bryan,

[ snip ... ]

> Do you think changing Postgres' code is more "elegant" than configuring
> your system(s) ?

JC,

I agree that conf is better than a rebuild in most cases...but:
In Bryan's defence, hacking globals.c *is* recommended in the man pages.
(Nonetheless, I added an explanation - and my patch - to my log files.
I think any DBA/SysAdmin who's been around awhile sees the value of
a good log/commented code...)

> That's NOT what I call "elegant" and, as a project manager, I would be
> quite angry with the person who messed like this.

You know one things does cause me to scratch my head: Pg does seem
to require new env vars fairly often.

I had about 4 or 5 set initially, then DBD wanted POSTGRES_INCLUDE
and POSTGRES_LIB.  Now, with a default behaviour change, we need
PGDATESTYLE.  One would think these guys at Pg are a band of merry
pranksters, eh?    ;-)

Cheers,
Tom

--------------------------------------------------------------------
               SVCMC - Center for Behavioral Health
--------------------------------------------------------------------
Thomas Good                          tomg@ { admin | q8 } .nrnet.org
IS Coordinator / DBA                 Phone: 718-354-5528
                                     Fax:   718-354-5056
--------------------------------------------------------------------
Powered by:  PostgreSQL     s l a c k w a r e          FreeBSD:
               RDBMS       |---------- linux      The Power To Serve
--------------------------------------------------------------------


Re[4]: changing datestyle

От
Jean-Christophe Boggio
Дата:
Thomas,

Ref : Tuesday, October 31, 2000 6:46:46 PM

TG> I agree that conf is better than a rebuild in most cases...but:
TG> In Bryan's defence, hacking globals.c *is* recommended in the man pages.

Woops! my apologies to Bryan, haven't read that (or maybe slipped on
it ;-) )

However, I think if the problem arises for me, I will prefer config
over "broken" code : the time it takes to find a cause of trouble is
manageable only with config. My PoV :)

TG> (Nonetheless, I added an explanation - and my patch - to my log files.
TG> I think any DBA/SysAdmin who's been around awhile sees the value of
TG> a good log/commented code...)

The DBA part of me says yes and the developer part is not so sure ;-)

TG> You know one things does cause me to scratch my head: Pg does seem
TG> to require new env vars fairly often.

TG> I had about 4 or 5 set initially, then DBD wanted POSTGRES_INCLUDE
TG> and POSTGRES_LIB.  Now, with a default behaviour change, we need
TG> PGDATESTYLE.  One would think these guys at Pg are a band of merry
TG> pranksters, eh?    ;-)

Apparently, this is just the result of your success !

Have you tried installing Oracle 8.0 and then 8.1 ? Do you know how
many env variables have been added between the 2 versions ? You think
you can tolerate the comparison ?

Regards,

--
Jean-Christophe Boggio
cat@thefreecat.org
Independant Consultant and Developer
Delphi, Linux, Oracle, Perl