Обсуждение: Re: Copy Failure

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

Re: Copy Failure

От
Дата:
--- operationsengineer1@yahoo.com wrote:

>
>
> --- Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> > <operationsengineer1@yahoo.com> writes:
> > > i'm trying to copy data from a csv file into a
> > PGSQL
> > > 7.4 database.  i tried tab delimited and i tried
> > comma
> > > delimted.
> >
> > PG 7.4's COPY does not have any support for CSV
> > format (that was added
> > in 8.0).  Tab-delimited should work OK though.
> >
> >             regards, tom lane
> >

Tom and all,

i was able to copy to work...  i saved it in
openoffice.org as a csv file, but i saved it as

Western Europe (ASCII/US)

instead of...

Western Europe (Windows-1252/Latin 1).

the latter inserted a character for for the tab and it
caused problems.

openoffice.org also gave two choice for a text
delimiter (i set the field delimiter to {tab}), ' and
".  when i copied with the text delimiter, the text
delimiter showed up in the pgsql data.

i went back and played with the text delimiter option
and found out that you can delete the text delimiter
resulting in nothing being the text delimiter.

the data copied fine and there was no sign of the text
delimiter in the db.



____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs


Sorting Challenge

От
Дата:
hi all,

i have another sorting problem.  i have data that
looks like...

sm2
sm101

i have a lot more data like this, but i want to keep
it simple.  the first two alphas represent an area and
the foloowing digit(s) represent a unique id.

the data is currently held in a text field.

i'm using (this is trimmed down)...

$sql_ipc_defect_code = 'SELECT code, code || \' - \'
|| description FROM defect ORDER BY LOWER(code) ASC';

this will list sm101 prior to sm2, which i think it
expected given my current order scheme.  but it isn't
what i want.

is there a way to sort this so that sm2 will come
before sm101?  do i need to change my data types?

tia...



____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs


Re: Sorting Challenge

От
Bruno Wolff III
Дата:
On Tue, Aug 30, 2005 at 15:58:40 -0700,
  operationsengineer1@yahoo.com wrote:
>
> i have a lot more data like this, but i want to keep
> it simple.  the first two alphas represent an area and
> the foloowing digit(s) represent a unique id.
>
> the data is currently held in a text field.

It generally isn't a good idea to store multiple fields in one column.
You should probably split this into two columns unless there is a significant
performance problem with doing so.

If there is than you might try creating an operator class that properly
compares these strings. Then you can use that operator class to do sorts
or create btree indexes.

Re: Sorting Challenge

От
Дата:
> On Tue, Aug 30, 2005 at 15:58:40 -0700,
>   operationsengineer1@yahoo.com wrote:
> >
> > i have a lot more data like this, but i want to
> keep
> > it simple.  the first two alphas represent an area
> and
> > the foloowing digit(s) represent a unique id.
> >
> > the data is currently held in a text field.
>
> It generally isn't a good idea to store multiple
> fields in one column.
> You should probably split this into two columns
> unless there is a significant
> performance problem with doing so.
>
> If there is than you might try creating an operator
> class that properly
> compares these strings. Then you can use that
> operator class to do sorts
> or create btree indexes.

hi Bruno,

the code is actually a single field.  the reason it
isn't just a numeric value is b/c i thought there
would be value in making the code somewhat human
readable.

as it stands now, a person can look at the defect code
and know will know the causal process.

is there a better way to make the code semi-human
readable and still act as a defect code (and primary
key)?

tia...

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

PGSQL, Fedora core 3 and a PII 400 MHz Box

От
Дата:
PGSQL, Fedora core 3 and a PII(I?) 400 MHz Box

is this doable to create a reasonably usable server (3
simultaneous connections, max)?

i know i will have to refrain from loading all the gui
stuff.

are there instructions for loading / upgrading PGSQL /
Apache / PHP from the command line?

tia...



____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs


Re: Sorting Challenge

От
Bruno Wolff III
Дата:
On Tue, Aug 30, 2005 at 22:51:34 -0700,
  operationsengineer1@yahoo.com wrote:
>
> the code is actually a single field.  the reason it
> isn't just a numeric value is b/c i thought there
> would be value in making the code somewhat human
> readable.
>
> as it stands now, a person can look at the defect code
> and know will know the causal process.
>
> is there a better way to make the code semi-human
> readable and still act as a defect code (and primary
> key)?

Yes, split it into two columns and use the combination of columns as a
primary key. When displaying the information to humans, concatenate the
two fields. You could even create a view which has a column with the
concatenated fields.