Put your tips and tricks online - Share your knowledge! Login | Register
 
 
  Search     Advanced search
 

Home | Ask Question | Add tip | My tips | Recent tips & tricks | Suggest a category | FAQ | Forums

 
 
 
 Found 7 tips, Displaying 1 - 7 
 
Sort by 
 
 Change client_encoding in psql
Example - this will set encoding to cyrillic WIN1251: set client_encoding to 'WIN';
     
More...

03/30/07
 
 
 Run external script in psql
To run a script against a PostgreSQL database from Unix / Linux command prompt do the following: psql [database name] < [script name] Otherwise if you are connected to database through psql and want to call an external script you can use \i for example: testdb=# \i [script name]
     
More...

03/30/07
 
 
 Change PostgreSQL table column
In this example a column type is changed to varchar of size up to 10 characters: ALTER TABLE [table name] ALTER COLUMN [column name] TYPE VARCHAR(10);
 More...
02/27/07
 
 
 How to add a column to PostgreSQL table
Below example adds a new column of type varchar and length 10 characters to a PostgreSQL database table: psql> ALTER TABLE [table_name] ADD COLUMN [column_name] VARCHAR(10); You can run it from psql, phpPgAdmin or any other admin tool
 More...
01/19/07
 
 
 How to reset sequence to a specific number
If you need to set a sequence to start from a specific number in PostgreSQL run this command in psql or phpPgAdmin: alter sequence [sequence_name] restart with 436; In this particular example the sequence will start from 436.
     
More...

11/08/06
 
 
 Select nextval from multiple sequences at the same time
Sometimes you may want to get nextval from several sequences at the same time, i.e. if fields are not set to auto increment and you want to run transaction from php script, this will save calls to pg_query and pg_fetch_array. Here's one of the ways to do it in PostgreSQL ...
 More...
08/09/06
 
 
 Selecting random record
To select a random record from PostgreSQL table use the following SQL statement: SELECT col_name FROM table_name ORDER BY random() LIMIT 1;
 More...
02/16/06
 
 


Recent tips & tricks
Mobile Phones / Tablets > Android : smb not working with Samsung G...
Databases > Oracle > Performance Tuning : When and what's been analyzed
Databases > Oracle > Performance Tuning : Sessions, transactions and rol...
Databases > Oracle > ASM : ASM empty directory doesn't ge...

More categories
Databases | Programming | Hardware | Operating Systems | Networking | Internet | ERP / CRM | Games & Multimedia | Graphics & Design | Miscellaneous | Mobile Phones / Tablets | Office Software
 

Home |  FAQ |  Terms of Use |  Privacy Policy

© 2005 tiplib.com