[SQL] Tsearch

2008-06-12 Thread PostgreSQL Admin

this is a small sample of the data:

   short_desc
|   long_desc   
--+
CHICKEN,BROILERS OR FRYERS,LEG,MEAT&SKN,CKD,FRIED,BATTER | Chicken, 
broilers or fryers, leg, meat and skin, cooked, fried, batter


Is the best method of search through this data full text search via 
tsearch or some other method.  I'm running version 8.3


say I want to search for chicken skin?

Thanks for the advice,
J

--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


[SQL] COPY command and required file permissions

2008-06-12 Thread Harold A. Giménez Ch.
Hi all,
In migrating an application from sql server to Postgres, I created a ruby
script that extracts csv files from sql server (from a windows box), then
SCPs them into a directory (/home/ruby_process) on the server running
Postgres (a Fedora core 8) and finally runs the Postgres COPY command for
each of the csv files.

When the script runs the COPY commnand, I get the following error (for the
genders table):

ERRORC42501  M could not open file "/home/ruby_process/genders.csv" for
reading: Permission denied Fcopy.c L1694   RCopyFrom (RuntimeError)

My question is, what are the set of permissions required to perform a
postgres copy?

I've set the permissions on the directory so that the postgres group owns
the directory and has read and execute permissions, as follows:
drwxrwxr-x 3 ruby_process postgres

I have also tried moving the files to /tmp and performing the copy from
there, unsuccesfuly.

Any ideas would be appreciated. Thanks,
-Harold


Re: [SQL] COPY command and required file permissions

2008-06-12 Thread Pavel Stehule
2008/6/12 Harold A. Giménez Ch. <[EMAIL PROTECTED]>:
> Hi all,
> In migrating an application from sql server to Postgres, I created a ruby
> script that extracts csv files from sql server (from a windows box), then
> SCPs them into a directory (/home/ruby_process) on the server running
> Postgres (a Fedora core 8) and finally runs the Postgres COPY command for
> each of the csv files.
>
> When the script runs the COPY commnand, I get the following error (for the
> genders table):
>
> ERRORC42501  M could not open file "/home/ruby_process/genders.csv" for
> reading: Permission denied Fcopy.c L1694   RCopyFrom (RuntimeError)
>



> My question is, what are the set of permissions required to perform a
> postgres copy?

user postgres has to have access for read.

regards
Pavel Stehule

>
> I've set the permissions on the directory so that the postgres group owns
> the directory and has read and execute permissions, as follows:
> drwxrwxr-x 3 ruby_process postgres
>
> I have also tried moving the files to /tmp and performing the copy from
> there, unsuccesfuly.
>
> Any ideas would be appreciated. Thanks,
> -Harold
>
>

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] COPY command and required file permissions

2008-06-12 Thread Tom Lane
"=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch.?=" <[EMAIL PROTECTED]> writes:
> In migrating an application from sql server to Postgres, I created a ruby
> script that extracts csv files from sql server (from a windows box), then
> SCPs them into a directory (/home/ruby_process) on the server running
> Postgres (a Fedora core 8) and finally runs the Postgres COPY command for
> each of the csv files.

> When the script runs the COPY commnand, I get the following error (for the
> genders table):

> ERRORC42501  M could not open file "/home/ruby_process/genders.csv" for
> reading: Permission denied Fcopy.c L1694   RCopyFrom (RuntimeError)

If you have the directory and file permissions straight, then my guess
is that you have SELinux turned on and it's disallowing the postgres
daemon from accessing anything "out of the ordinary".  The best fix
is probably to adjust the security labeling on your transfer directory.
I can't give you a cookbook recipe for that, but something along the
line of

/usr/bin/chcon -u system_u -r object_r -t postgresql_db_t /home/ruby_process

might do it.  I'm not sure if you'd need to fool with the permissions on
/home as well.

The easiest fix is to disable SELinux, but I wouldn't recommend that
unless the machine is entirely isolated from the internet.

regards, tom lane

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql


Re: [SQL] COPY command and required file permissions

2008-06-12 Thread Harold A. Giménez Ch.
Thanks for the info. SELinux was the guilty party...

On Thu, Jun 12, 2008 at 10:48 AM, Tom Lane <[EMAIL PROTECTED]> wrote:

> "=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch.?=" <[EMAIL PROTECTED]>
> writes:
> > In migrating an application from sql server to Postgres, I created a ruby
> > script that extracts csv files from sql server (from a windows box), then
> > SCPs them into a directory (/home/ruby_process) on the server running
> > Postgres (a Fedora core 8) and finally runs the Postgres COPY command for
> > each of the csv files.
>
> > When the script runs the COPY commnand, I get the following error (for
> the
> > genders table):
>
> > ERRORC42501  M could not open file "/home/ruby_process/genders.csv"
> for
> > reading: Permission denied Fcopy.c L1694   RCopyFrom (RuntimeError)
>
> If you have the directory and file permissions straight, then my guess
> is that you have SELinux turned on and it's disallowing the postgres
> daemon from accessing anything "out of the ordinary".  The best fix
> is probably to adjust the security labeling on your transfer directory.
> I can't give you a cookbook recipe for that, but something along the
> line of
>
> /usr/bin/chcon -u system_u -r object_r -t postgresql_db_t
> /home/ruby_process
>
> might do it.  I'm not sure if you'd need to fool with the permissions on
> /home as well.
>
> The easiest fix is to disable SELinux, but I wouldn't recommend that
> unless the machine is entirely isolated from the internet.
>
>regards, tom lane
>


Re: [SQL] Tsearch

2008-06-12 Thread Steve Midgley

At 12:20 PM 6/12/2008, [EMAIL PROTECTED] wrote:

Date: Thu, 12 Jun 2008 08:47:44 -0400
From: PostgreSQL Admin <[EMAIL PROTECTED]>
To: pgsql-sql@postgresql.org
Subject: Tsearch
Message-ID: <[EMAIL PROTECTED]>

this is a small sample of the data:

short_desc
|   long_desc 


--+
 CHICKEN,BROILERS OR FRYERS,LEG,MEAT&SKN,CKD,FRIED,BATTER | Chicken,
broilers or fryers, leg, meat and skin, cooked, fried, batter

Is the best method of search through this data full text search via
tsearch or some other method.  I'm running version 8.3

say I want to search for chicken skin?

Thanks for the advice,
J


Having previously established myself as a non-expert on TSearch2, I 
hesitate to post, but I think your issue is data semantics more than 
search tool. How do you want your system to handle this psuedo data:


Chicken broilers, pork skins

Should that return a match for "chicken skins" or not? If your data are 
semantically stored such that any record that matches "chicken" and 
also matches "skin" refers to "the skins of chickens" (the actual 
meaning you are looking for), then you're going to have a relatively 
easy time of it.


If not, you'll have to consider ways to code your data so that searches 
behave correctly. You could develop search / coding schemes that say 
things like "find all records with chicken and skin, where the 
following words do not appear between the words chicken and skin: beef, 
pork, cow, pig, etc.."


Just some thoughts for you there.

Best,

Steve


--
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql