Community Page
- www.codespatter.com Jump to website »
-
Subscribe -
Community
-
Top Commenters
-
Popular Threads
-
Recent Comments
- You can do this. from somewhere import SoftDeleteManager class NewManager(SoftDeleteManager): '''new stuff''' and in the model objects = NewManager()
- Great writeup, thanks for that! I'll have question though. Say I import SoftDeleteManager from an external file and use it with objects = SoftDeleteManager() But now, I loose ability to define...
- thanks, man!
- Yes! Finally I know where that annoying example.com lives! Thank you!
- Thanks very much! I think you just saved me a lot of stuffing around with settings.py
Jump to original thread »
If you’ve decided to move a few tables from MySQL to PostgreSQL, these few tips might help. I won’t get into any reasons why to move to PostgreSQL or not. There are already
many discussions on
the topic.
Create Syntax
The first five listed need to be done in order ... Continue reading »
many discussions on
the topic.
Create Syntax
The first five listed need to be done in order ... Continue reading »
1 year ago
WTF!? This can seriously break many schemas. Don't do this.
Postres supports multiple-row inserts only in latest versions (8.3+ IIRC).
another useful replacement may be CURRENT_TIMESTAMP with NOW() and timestamp with timestamp without time zone, etc.
1 year ago
Thanks for the comment. I updated the post to cross out the NOT NULL part, I think I meant that only for the auto_increment part, but messed it up.
I'll check out the newer versions to see what's been changed. I was on 7.4.7.
1 year ago
- An enum column in MySQL is equal to a varchar with a check constraint in PostgreSQL, for example:
column_name enum('foo', 'bar') is equal to column_name varchar(3) check (column_name IN ('foo', 'bar'))
- The blob datatype in MySQL is equal to a bytea datatype in PostgreSQL
Also, when truncating a table, I do not believe PostgreSQL resets the sequence for serial columns, so it will need to be done manually.
Obviously there are more differences when moving to PostgreSQL, but these are most of the big ones for CREATE TABLE statements.
Just a little FYI. I wrote these all out, but forgot my email. Your blog is very unfriendly to comments without an email, as in I lost my comments.
1 year ago
11 months ago
CREATE TABLE manila_area_tbl
(
area_no tinyint(4) NOT NULL auto_increment,
area_name varchar(65) NOT NULL,
disp_flag char(1) NOT NULL default '1',
disp_no tinyint(4) NOT NULL,
del_flag char(1) NOT NULL default '0',
PRIMARY KEY (`area_no`),
KEY disp_no` (`disp_no`),KEY `del_flag` (`del_flag`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=25;
11 months ago
Try running these 4 queries.
CREATE TABLE manila_area_tbl
(
area_no SERIAL,
area_name varchar(65) NOT NULL,
disp_flag char(1) NOT NULL default 1,
disp_no smallint NOT NULL,
del_flag char(1) NOT NULL default 0,
PRIMARY KEY (area_no)
) ;
CREATE INDEX disp_no ON manila_area_tbl (disp_no);
CREATE INDEX del_flag ON manila_area_tbl (del_flag);
ALTER SEQUENCE manila_area_tbl_area_no_seq RESTART WITH 25;
9 months ago
do you know how to do something like this ?
ALTER SEQUENCE univers_id_seq RESTART WITH (SELECT max(id) + 1 FROM univers);
Thanks
Emilien
9 months ago
ALTER SEQUENCE univers_id_seq RESTART WITH (SELECT max(id) FROM univers)+1;