# Azamat H. Hackimov , 2010. msgid "" msgstr "" "Project-Id-Version: \n" "POT-Creation-Date: 2010-10-21 23:56+0600\n" "PO-Revision-Date: 2010-02-09 01:06+0500\n" "Last-Translator: Azamat H. Hackimov \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" "X-Generator: Lokalize 1.0\n" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(guide:link):5 msgid "/doc/en/postgres-howto.xml" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(guide:lang):5 msgid "en" msgstr "ru" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):6 msgid "PostgreSQL Guide" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(author:title):8 msgid "Author" msgstr "автор" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(mail:link):9 msgid "chriswhite@gentoo.org" msgstr "chriswhite@gentoo.org" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(mail):9 msgid "Chris White" msgstr "Chris White" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(author:title):11 msgid "Editor" msgstr "редактор" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(mail:link):12 msgid "neysx@gentoo.org" msgstr "neysx@gentoo.org" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(mail):12 msgid "Xavier Neys" msgstr "Xavier Neys" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(abstract):15 msgid "" "This guide is meant to show the basic setup of PostgreSQL. The setup " "described here should be sufficient enough to use for basic web " "appplications, and any other program that provides PostgreSQL support." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(version):25 msgid "1.2" msgstr "1.2" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(date):26 msgid "2007-04-25" msgstr "2007-04-25" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):29 msgid "Introduction" msgstr "Введение" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):31 msgid "PostgreSQL introduction" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):34 msgid "" "When talking to most developers about the different database solutions to " "use, two major databases will usually form the answer. One would be " "MySQL, and the other is what this document will refer to, " "PostgreSQL. The advantages of one over the other is a somewhat long " "winded debate, however it is just to say that PostgreSQL has had a more firm " "grasp on true relational database structure than MySQL. Most of the standard " "features such as FOREIGN KEY was only just added in MySQL 5. However, " "whatever the case may be, this document assumes that you have selected " "PostgreSQL as the database to use. The first place to start is the " "emerge process. In the next section, the installation process through " "emerge will be described, as well as the basic configuration." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):51 msgid "PostgreSQL installation" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):54 msgid "" "To begin, we must first emerge the PostgreSQL package. To do so, run " "the following code to first ensure that the options for it are properly set:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):59 msgid "Checking the PostgreSQL build options" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):59 #, no-wrap msgid "" "\n" "# emerge -pv postgresql\n" "\n" "These are the packages that I would merge, in order:\n" "\n" "Calculating dependencies ...done!\n" "[ebuild N ] dev-db/postgresql-8.0.4 -doc -kerberos +nls +pam +perl -pg-intdatetime +python +readline (-selinux) +ssl -tcl +xml +zlib 0 kB\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):68 msgid "Here's a list of what the different build options indicate:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(th):74 msgid "USE Flag" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(th):75 msgid "Meaning" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):78 msgid "doc" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):79 msgid "" "This USE flag enables or disables the installation of documentation outside " "of the standard man pages. The one good time to disable this option is if " "you are low on space, or you have alternate methods of getting a hold of the " "documentation (online, etc.)" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):87 msgid "kerberos" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):88 msgid "" "When connecting to the database, with this option enabled, the admin has the " "option of using kerberos to authenticate their users/services to the " "database." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):95 msgid "nls" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):96 msgid "" "If this option is enabled, PostgreSQL can utilize translated strings for non-" "English speaking users." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):102 msgid "pam" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):103 msgid "" "If this option is enabled, and the admin configures the PostgreSQL " "configuration file properly, users/services will be able to login to a " "PostgreSQL database using PAM (Pluggable Authentication Module)." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):110 msgid "perl" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):111 msgid "" "If this option is enabled, perl bindings for PostgreSQL will be built." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):117 msgid "pg-intdatetime" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):118 msgid "" "If this option is enabled, PostgreSQL will support 64 bit integer date types." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):124 msgid "python" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):125 msgid "" "If this option is enabled, PostgreSQL will be built with python " "bindings." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):131 msgid "readline" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):132 msgid "" "If this option is enabled, PostgreSQL will support readline style " "command line editing. This includes command history and isearch." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):138 msgid "selinux" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):139 msgid "" "If this option is enabled, an selinux policy for PostgreSQL will be " "installed." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):145 msgid "ssl" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):146 msgid "" "If this option is enabled, PostgreSQL will utilize the OpenSSL " "library to encrypt traffic between PostgreSQL clients and servers." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):152 msgid "tcl" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):153 msgid "If this option is enabled, PostgreSQL will build tcl bindings." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):158 msgid "xml" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):159 msgid "" "If this option is enabled, XPATH style xml support will be built. " "More information on using xml support with PostgreSQL can be found on: PostgreSQL " "and XML." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):167 msgid "zlib" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):168 msgid "" "This isn't really used by PostgreSQL itself, but by pg_dump to " "compress the dumps it produces." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):175 msgid "" "Once you've customized PostgreSQL to meet your specific needs, go ahead and " "start the emerge:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):180 msgid "Emerge-ing PostgreSQL" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):180 #, no-wrap msgid "" "\n" "# emerge postgresql\n" "(Output shortened)\n" ">>> /usr/lib/libecpg.so.5 -> libecpg.so.5.0\n" ">>> /usr/bin/postmaster -> postgres\n" " * Make sure the postgres user in /etc/passwd has an account setup with /bin/bash as the shell\n" " *\n" " * Execute the following command\n" " * emerge --config =postgresql-8.0.4\n" " * to setup the initial database environment.\n" " *\n" ">>> Regenerating /etc/ld.so.cache...\n" ">>> dev-db/postgresql-8.0.4 merged.\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):195 msgid "" "As shown by the einfo output, there is some post setup that must be done. " "The next chapter will look at the actual configuration of PostgreSQL." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):204 msgid "PostgreSQL configuration" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):206 msgid "Setting up the initial database environment" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):209 msgid "" "As noted in the earlier emerge output, the initial database " "environment must be setup. However, before this is done, one thing needs to " "be considered. Unlike, say MySQL, PostgreSQL's \"root\" password is the " "password of the actual user. However, only the user is created by the ebuild " "not the password. So before we can begin, the password must be set " "for the postgres user:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):217 msgid "Setting the password" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):217 #, no-wrap msgid "" "\n" "# passwd postgres\n" "New UNIX password:\n" "Retype new UNIX password:\n" "passwd: password updated successfully\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):224 msgid "" "Now that this is set up, the creation of the initial database environment " "can occur:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):229 msgid "Configuring the database environment with emerge --config" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):229 #, no-wrap msgid "" "\n" "# emerge --config =postgresql-8.0.4\n" "\n" "\n" "Configuring pkg...\n" "\n" " * Creating the data directory ...\n" " * Initializing the database ...\n" "The files belonging to this database system will be owned by user \"postgres\".\n" "This user must also own the server process.\n" "\n" "The database cluster will be initialized with locale C.\n" "\n" "fixing permissions on existing directory /var/lib/postgresql/data ... ok\n" "creating directory /var/lib/postgresql/data/global ... ok\n" "creating directory /var/lib/postgresql/data/pg_xlog ... ok\n" "creating directory /var/lib/postgresql/data/pg_xlog/archive_status ... ok\n" "creating directory /var/lib/postgresql/data/pg_clog ... ok\n" "creating directory /var/lib/postgresql/data/pg_subtrans ... ok\n" "creating directory /var/lib/postgresql/data/base ... ok\n" "creating directory /var/lib/postgresql/data/base/1 ... ok\n" "creating directory /var/lib/postgresql/data/pg_tblspc ... ok\n" "selecting default max_connections ... 100\n" "selecting default shared_buffers ... 1000\n" "creating configuration files ... ok\n" "creating template1 database in /var/lib/postgresql/data/base/1 ... ok\n" "initializing pg_shadow ... ok\n" "enabling unlimited row size for system tables ... ok\n" "initializing pg_depend ... ok\n" "creating system views ... ok\n" "loading pg_description ... ok\n" "creating conversions ... ok\n" "setting privileges on built-in objects ... ok\n" "creating information schema ... ok\n" "vacuuming database template1 ... ok\n" "copying template1 to template0 ... ok\n" "\n" "WARNING: enabling \"trust\" authentication for local connections\n" "You can change this by editing pg_hba.conf or using the -A option the\n" "next time you run initdb.\n" "\n" "Success. You can now start the database server using:\n" "\n" " /usr/bin/postmaster -D /var/lib/postgresql/data\n" "or\n" " /usr/bin/pg_ctl -D /var/lib/postgresql/data -l logfile start\n" "\n" " *\n" " * You can use /etc/init.d/postgresql script to run PostgreSQL instead of pg_ctl.\n" " *\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):281 msgid "" "Now the initial database environment is setup. The next section will look at " "verifying the install and setting up users to access the database." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):289 msgid "PostgreSQL database setup" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):292 msgid "" "Now that PostgreSQL is setup, it's a good idea at this point to verify the " "installation. First, make sure the service starts up ok:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):297 msgid "Starting up the PostgreSQL service" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):297 #, no-wrap msgid "" "\n" "# /etc/init.d/postgresql start\n" "* Starting PostgreSQL ... [ ok ]\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):302 msgid "" "Once this is verified working, it's also a good idea to add it to the " "default runlevel so it starts at boot:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):307 msgid "Adding to the default runlevel" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):307 #, no-wrap msgid "" "\n" "# rc-update add postgresql default\n" "* postgresql added to runlevel default\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):312 msgid "" "Now that the service has started, it's time to try setting up a test " "database. To start out, let's create a test database by using the " "createdb command. We'll also pass along the -U option to set " "the user (it defaults to the current user name if you don't), and the -W option to request the password we created earlier. Finally we give it the " "name of the database we want to create:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):321 msgid "Creating a database with createdb" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):321 #, no-wrap msgid "" "\n" "$ createdb -U postgres -W test\n" "Password:\n" "CREATE DATABASE\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):327 msgid "" "The database was successfully created, and we can confirm that the database " "can run basic tasks. We'll go ahead and drop this database (remove it) with " "the dropdb command:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):333 msgid "Dropping a database with dropdb" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):333 #, no-wrap msgid "" "\n" "$ dropdb -U postgres -W test\n" "Password:\n" "DROP DATABASE\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):339 msgid "" "Right now, only the postgres user can run commands. Obviously this is not " "the sort of setup one would like in a multi-user environment. The next " "section will look at working with user accounts." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):348 msgid "Setting up database user accounts" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):351 msgid "" "As mentioned earlier, having to login as the postgres user is somewhat " "undesirable in a mult-user environment. In most cases there will be various " "users and services accessing the server, and each have different permission " "requirements. So, to handle this, the createuser command can be used. " "This command is an alternative to running a few SQL queries, and is a lot " "more flexible from an admin standpoint. We'll go ahead and create two users, " "a 'superuser' that can add other users and administer the db, and a standard " "user:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):361 msgid "Setting up the superuser" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):361 #, no-wrap msgid "" "\n" "(replace chris with the username you'd like to use)\n" "$ createuser -a -d -P -E -U postgres -W chris\n" "Enter password for new user:\n" "Enter it again:\n" "Password:\n" "CREATE USER\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):370 msgid "" "There, we've created the superuser. The command line option -a " "specifies that this user can add other users. -d means that this user " "can create databases. -P let's you enter a password for the user and " "-E will encrypt it for security purposes. Now then, we'll test this " "new user's permissions out by setting up our standard user:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):378 msgid "Setting up the standard user" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):378 #, no-wrap msgid "" "\n" "(replace chris with the username you've just created)\n" "$ createuser -A -D -P -E -U chris -W testuser\n" "Enter password for new user:\n" "Enter it again:\n" "Password:\n" "CREATE USER\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):387 msgid "" "Success! Our new user was created using the previously created superuser. " "The -A and -D options do the opposite of -a and -d, and instead deny the user the ability to create other users and " "databases. Now that there are users to work with, the next chapter will look " "at using the new database." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):399 msgid "Using PostgreSQL" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):401 msgid "Setting up permissions" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):404 msgid "" "Now there is a user that can create databases and add other users, and the " "main postgres user that can do anything. The user created earlier can " "currently login to the server, and that's about it. In general, users need " "to be able to insert data and retrieve data, and sometimes any other number " "of tasks. So, for this new user to be able to do anything, they must be " "setup with the proper permissions. This can easily be done by passing the " "-O parameter to createdb. We'll start by making a new " "database, MyDB with our superuser that will be owned by the previous " "testuser:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):415 msgid "Creating the MyDB database" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):415 #, no-wrap msgid "" "\n" "$ createdb -O testuser -U chris -W MyDB\n" "Password:\n" "CREATE DATABASE\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):421 msgid "" "Alright, now we have a new MyDB database, and a testuser that can access it. " "To test this out, we'll login as the testuser to the new MyDB database. " "We'll do this with the psql program. This program is what's used to " "connect to the PostgreSQL database from command line. So connect to the new " "database like so:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):429 msgid "Logging into the MyDB database as the testuser" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):429 #, no-wrap msgid "" "\n" "$ psql -U testuser -W MyDB\n" "Password:\n" "Welcome to psql 8.0.4, the PostgreSQL interactive terminal.\n" "\n" "Type: \\copyright for distribution terms\n" " \\h for help with SQL commands\n" " \\? for help with psql commands\n" " \\g or terminate with semicolon to execute query\n" " \\q to quit\n" "\n" "MyDB=>\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):443 msgid "" "So, the testuser is now logged into the database, and can begin to initiate " "some commands. To get a feel for using PostgreSQL, the next section will " "take a look at some of the basic commands in navigating the psql " "client." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):452 msgid "Basic PostgreSQL commands and creating a table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):455 msgid "" "For those who are used to MySQL, this is somewhat of a definite read. This " "is where PostgreSQL may get somewhat unique with regards to running " "commands. To start, here is a list of some commands that will be discussed:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(th):463 msgid "Command" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(th):464 msgid "Usage" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(th):465 msgid "MySQL Equivalent" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):468 msgid "\\c[onnect] [DBNAME|- [USER]]" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):469 msgid "Connects to another database" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):470 msgid "USE DATABASE" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):473 msgid "\\q" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):474 msgid "Quit the psql client" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):475 msgid "quit" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):478 msgid "\\i FILE" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):479 msgid "Run commands from FILE" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):480 msgid "source FILE" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):483 msgid "\\o [FILE]" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):484 msgid "Send query results to FILE" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):485 msgid "INTO OUTFILE, but outputs everything (not just SELECTS)" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):488 msgid "\\d [NAME]" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):489 msgid "Describe a database or table (as well as other items)" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):490 msgid "DESC(RIBE)" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):493 msgid "\\db [PATTERN]" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):494 msgid "" "List available tables that match PATTERN (all if no pattern is given)" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(ti):498 msgid "SHOW TABLES" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):502 msgid "" "With the exception of \\c[onnect], all the commands shown will be " "used later on in the section. So right now the database is empty. That said, " "we need to insert some data. The first step to inserting data, however, is " "to put it in a table. Right now there are no tables in the database, so we " "need to create one. This is done with the CREATE TABLE command. We'll " "make a table of items. They will contain a Product ID, Description, and " "price:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):511 msgid "Creating the products table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):511 #, no-wrap msgid "" "\n" "MyDB=> CREATE TABLE products (\n" "MyDB(> product_id SERIAL,\n" "MyDB(> description TEXT,\n" "MyDB(> price DECIMAL\n" "MyDB(> );\n" "NOTICE: CREATE TABLE will create implicit sequence \"products_product_id_seq\"\n" "for serial column \"products.product_id\"\n" "CREATE TABLE\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):522 msgid "" "You can ignore the NOTICE, it's perfectly harmless. Looking at the last line " "of the function, CREATE TABLE seems to indicate that the command has " "succeeded. However, let's go ahead and verify that the table was indeed " "successfully created with the \\d command:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):529 msgid "Looking at the newly created table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):529 #, no-wrap msgid "" "\n" "MyDB=> \\d products\n" " Table \"public.products\"\n" " Column | Type | Modifiers\n" "-------------+---------+------------------------------------------------------------------\n" " product_id | integer | not null default nextval('public.products_product_id_seq'::text)\n" " description | text |\n" " price | numeric |\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):539 msgid "" "Indeed the table was successfully created. Now that the table is created, it " "needs to be populated with data. The next section will look at populating " "the database with data." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):548 msgid "Inserting data into the database" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):551 msgid "" "This section will look at the two ways of populating the newly created table " "with data. First let's look at the most basic command, INSERT:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):556 msgid "INSERT syntax" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):556 #, no-wrap msgid "" "\n" "INSERT INTO [tablename] (column1,column2,column3) VALUES(value1,value2,value3)\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):560 msgid "" "tablename contains the name of the table to insert the data into. " "(column1,column2,column3) lets you specify the specific columns to insert " "the values into. VALUES(value1,value2,value3) is the listing of values. The " "values are inserted into the same order as the columns (column1 gets value1, " "column2 gets value2, column3 gets value3). These counts must be the " "same. So let's go ahead and insert an item into the table:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(impo):569 msgid "" "From working with databases for a long time, I personally recommend " "specifying INSERT statements exactly as above. Developers often make " "the mistake of using INSERT INTO without specifying columns. This is " "unproductive, as if a new column gets added to the database, it will cause " "in error if the value to column count is not the same. You should always specify the columns unless you're 300% sure you'll never add a column." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):578 msgid "Inserting data into the table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):578 #, no-wrap msgid "" "\n" "MyDB=> INSERT INTO products (description,price) VALUES('A test product', 12.00);\n" "INSERT 17273 1\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):583 msgid "" "The last line needs a bit of explaining. The return of an insert command is " "an OID (Object Identifier) and the number of rows inserted. OID's are a bit " "beyond the scope of this guide, and the PostgreSQL manual has some " "good information on it. Now, for a situation where you have 20,000 products, " "these insert statements can be a little tedious. However, not all is lost. " "The COPY command can be used to insert data into a table from a file " "or stdin. In this example, let's assume that you have a csv (comma separated " "values) file, which contains the product id, description, and price. The " "file looks like this:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):596 msgid "products.csv" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):596 #, no-wrap msgid "" "\n" "2,meat,6.79\n" "3,soup,0.69\n" "4,soda,1.79\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):602 msgid "Now we'll use the COPY command to populate our data:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(impo):606 msgid "" "The COPY FROM STDIN command is used because only the postgres user " "can insert data from a file (for obvious security reasons)." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):611 msgid "Using COPY to populate the products table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):611 #, no-wrap msgid "" "\n" "MyDB=> COPY products FROM STDIN WITH DELIMITER AS ',';\n" "Enter data to be copied followed by a newline.\n" "End with a backslash and a period on a line by itself.\n" ">> 2,meat,6.79\n" ">> 3,soup,0.69\n" ">> 4,soda,1.79\n" ">> \\.\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):621 msgid "" "Unfortunately, this line doesn't return the same status information as the " "INSERT INTO statement. How do we know the data was inserted? The next " "section will look at running queries to check our data." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):630 msgid "Using PostgreSQL queries" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):633 msgid "" "This section will look at using the SELECT statement to view data in " "our tables. The basic SELECT format looks like this:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):638 msgid "SELECT syntax" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):638 #, no-wrap msgid "" "\n" "SELECT (column1,column2|*) FROM (table) [WHERE (conditionals)]\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):642 msgid "" "There are two ways to select columns. The first is using * to select " "all columns, and the second is to specify a list of specific columns you " "wish to see. The second is quite handy when you want to find a specific " "column in a rather large list of them. Let's start out with using SELECT with * to specify all columns:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):650 msgid "Viewing the products table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):650 #, no-wrap msgid "" "\n" "MyDB=> SELECT * FROM products;\n" " product_id | description | price\n" "------------+----------------+-------\n" " 1 | A test product | 12.00\n" " 2 | meat | 6.79\n" " 3 | soup | 0.69\n" " 4 | soda | 1.79\n" "(4 rows)\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):661 msgid "" "As shown here, all the data we inserted earlier is indeed in the table. Now " "let's say we only want to see the description and the price, and don't care " "about the product id. In this case we'll use the column specific SELECT form:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):667 msgid "Viewing specific columns from the products table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):667 #, no-wrap msgid "" "\n" "MyDB=> SELECT description,price FROM products;\n" " description | price\n" "----------------+-------\n" " A test product | 12.00\n" " meat | 6.79\n" " soup | 0.69\n" " soda | 1.79\n" "(4 rows)\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):678 msgid "" "Now only the product and price is shown, letting us focus on only the " "important data. Now let's say that we want to see only the items that are " "greater than $2.00. Here's where the WHERE clause comes in handy:" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre:caption):684 msgid "Viewing specific rows from the products table" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(pre):684 #, no-wrap msgid "" "\n" "MyDB=> SELECT description,price FROM products WHERE price > 2.00;\n" " description | price\n" "----------------+-------\n" " A test product | 12.00\n" " meat | 6.79\n" "(2 rows)\n" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):693 msgid "" "Now a listing of products over $2.00 is displayed, focusing the data even " "more. These forms of querying for information are very powerful, and can " "help create extremely useful reports." msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(title):702 msgid "Conclusion" msgstr "" #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(p):705 msgid "" "This concludes the PostgreSQL Guide. A big thanks goes to Masatomo Nakano, " "the previous Gentoo PostgreSQL maintainer for his help in answering my " "questions. Any suggestions on this guide should be sent to " "chriswhite@gentoo.org. For more extensive documentation, see " "the PostgreSQL website." msgstr "" #. Place here names of translator, one per line. Format should be NAME; ROLE; E-MAIL #: ../../gentoo/xml/htdocs/doc/en//postgres-howto.xml(None):0 msgid "translator-credits" msgstr ""